Syntax
VL=VLlink2P(p1,p2,[shape,excent])
Input Parameter
p1 : | | Start point or vertex |
p2 : | | End point or vertex |
shape : | | 'straight' or 'zigzag' |
excent : | | size of the eccentric part |
Output Parameter
VL : | | Vertex list of the shaped line |
Examples
Create a 2.5 D Object of a given link between two points
LVL=VLlink2P (p1,p2,'zigzag',1);
VLplot (LVL,'k-'); view (0,90); VLFLplot (NVL,NFL);
[NVL,NFL]=VLFLexpandPL(LVL',bx,h,false,bx/2);
NVL=VLtransP (NVL,[0;0;by/2]);
[VL,FL]=VLFLcat2(VL,FL,NVL,NFL);
Copyright 2012-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, VLlink2P
, generates a list of vertices representing a line between two points in 2D space. The line can be either straight or zigzag-shaped.
Input Parameters
- p1: The starting point or vertex, represented as a vector.
- p2: The ending point or vertex, also represented as a vector.
- shape: A string indicating the shape of the line. It can be either 'straight' or 'zigzag'. If not specified, the default is 'straight'.
- excent: A numeric value representing the size of the eccentric part of the zigzag. The default value is 1 if not provided.
Output
- VL: A list of vertices that define the shaped line between the two points.
Algorithm Steps
- Check if
p1
and p2
are column vectors. If not, transpose them.
- Set the third component of
p1
and p2
to 0 to ensure they are 2D points.
- Calculate the distance
l
between p1
and p2
.
- Compute the normalized direction vector
pn
from p1
to p2
.
- Calculate a perpendicular vector
po
to pn
.
- Use a switch statement to determine the shape of the line:
- Case 'straight': Directly connect
p1
and p2
with a straight line. The vertex list VL
contains only p1
and p2
.
- Case 'zigzag': Create a zigzag pattern between
p1
and p2
. The vertex list VL
includes intermediate points calculated using the eccentricity excent
and the vectors pn
and po
.
- Otherwise: If the shape is not recognized, an error is thrown indicating an unknown shape.
Algorithm explaination created using ChatGPT on 2025-08-19 07:26. (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