by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 1.0, Creation date: 2012-07-15, Last change: 2025-09-14
[OVEL,UVEL,AEL]=lsegment(p1,p2,t)
p1: | Starting point of an edge | |
p2: | End point of an edge | |
t: | list of points: [p=p1+t*(p2-p1) , direction] |
OVEL: | Edge list of an outer contour | |
UVEL: | Edge list of an inner contour | |
AEL: | Complete contour line |
This algorithm is designed to compute all supporting points of a line segment, including the start and end points, based on a given list of parameterized points. The function is named lsegment and is part of the SG-Library, specifically categorized under auxiliary procedures.
p = p1 + t * (p2 - p1) and includes a direction component.t using unique(t, 'rows').nt in t.t has an infinite parameter, remove it and decrement nt.nt is zero, initialize t with default points [0 0; 1 0] and set nt to 2.t has a parameter of 1. If not, append [1 0] to t and increment nt.t has a parameter of 0. If not, prepend [0 0] to t and increment nt.AVEL to store the contour line points.t in steps of 2:i is less than or equal to nt-1, compute the supporting points for the segment between t(i) and t(i+1) and append them to AVEL.i is less than or equal to nt-2, compute the supporting points for the segment between t(i+1) and t(i+2) and append them to AVEL.