Syntax
[VL,FL]=VLFLbar2P(PL,bx,by,bz)
Input Parameter
PL : | | List of 2 or 3 Points. 1st point is start point, 2nd point is end point, 3rd point is optional |
bx : | | desired size in x direction |
by : | | desired size in y direction |
bz : | | desired add-on or sub-on before start and after end point. |
Output Parameter
VL : | | Vertex List |
FL : | | Facet List |
Examples
VLFLbar2P([0 0 0; 10 10 10 ]',2,3,4)
VLFLbar2P([0 0 0; 10 10 10 ],2,3,4)
Copyright 2010-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, VLFLbar2P
, calculates a bar between two points, with an optional third point to define the x-axis. It is part of the SolidGeometry library.
Input Parameters
- PL: A list of 2 or 3 points. The first point is the start point, the second is the end point, and the third (optional) defines the x-axis.
- bx: Desired size in the x direction.
- by: Desired size in the y direction.
- bz: Desired add-on or sub-on before the start and after the end point.
Output Results
- VL: Vertex List.
- FL: Facet List.
Algorithm Steps
- Halve the values of
bx
, by
, and bz
.
- Extract the start point
pa
and end point pb
from PL
.
- If
PL
contains only two points:
- Calculate the transformation matrix
T
using Tof2P
with pa
and the vector pb-pa
.
- Extract the unit vectors
ex
, ey
, and ez
from T
.
- If
PL
contains three points:
- Extract the third point
pc
.
- Calculate
ez
as the vector pb-pa
.
- Calculate
ex
as the vector pc-pa
.
- Calculate
ey
as the cross product of ez
and ex
.
- Normalize
ex
, ey
, and ez
.
- Calculate the eight corner points
p1
to p8
of the bar using the unit vectors and the halved dimensions.
- Form a new point list
PL
with these corner points.
- Call
VLFLcuboid
with the new PL
to get the vertex list VL
and facet list FL
.
- If no output is requested, plot the bar using
SGfigure
and VLFLplotalpha
.
Algorithm explaination created using ChatGPT on 2025-08-19 07:41. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21