lsegment

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

returns all supporting points of a line/edge including start and end point, separated

Example Illustration

 missing image of lsegment(p1,p2,t)

Syntax

[OVEL,UVEL,AEL]=lsegment(p1,p2,t)

Input Parameter

p1: Starting point of an edge
p2: End point of an edge
t: list of points: [p=p1+t*(p2-p1) , direction]

Output Parameter

OVEL: Edge list of an outer contour
UVEL: Edge list of an inner contour
AEL: Complete contour line




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 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.

Input Parameters

Output Results

Algorithm Steps

  1. Remove duplicate rows from t using unique(t, 'rows').
  2. Determine the number of points nt in t.
  3. If the last point in t has an infinite parameter, remove it and decrement nt.
  4. If nt is zero, initialize t with default points [0 0; 1 0] and set nt to 2.
  5. Ensure the last point in t has a parameter of 1. If not, append [1 0] to t and increment nt.
  6. Ensure the first point in t has a parameter of 0. If not, prepend [0 0] to t and increment nt.
  7. Initialize an empty array AVEL to store the contour line points.
  8. Iterate over the points in t in steps of 2:
Algorithm explaination created using ChatGPT on 2025-08-18 23:17. (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