ELofCIL
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 3.9, Creation date: 2017-06-11, Last change: 2025-09-14
Converts a Contour Index List into an Edge list
Description
Contour index list [start index end index; start index end index ,...]
requires sorted ELs that are used to create the CIL
See Also: ELofn
Example Illustration
Syntax
EL=ELofCIL(CIL,[cl])
Input Parameter
CIL: | | Contour index list [start index end index; start end ,...] |
cl: | | closing; default is true |
Output Parameter
Examples
CPLsample(11); CPL=ans; [PL,EL]=PLELofCPL(CPL), CIL=CILofEL(EL), ELofCIL(CIL)
Copyright 2017-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, ELofCIL, converts a Contour Index List (CIL) into an Edge List (EL). It is part of the SolidGeometry library and was introduced in version 3.9.
Input Parameters
- CIL: A matrix representing the Contour Index List, where each row contains a start index and an end index.
- cl (optional): A boolean parameter indicating whether the contour should be closed. The default value is
true.
Output Results
- EL: The resulting Edge List, which is a matrix where each row represents an edge with a start and end point.
- PL: A list of starting points for each edge in the Edge List.
Algorithm Steps
- Initialize the
cl parameter to true. If a second argument is provided and is not empty, set cl to this value.
- Determine the number of contours,
nc, by getting the number of rows in CIL.
- Calculate the total number of edges,
n, by summing the differences between the end and start indices of each contour, plus one.
- Initialize the Edge List
EL as a zero matrix with n rows and 2 columns.
- Initialize a counter
k to zero.
- For each contour (from 1 to
nc):
- Create a list
PL of indices from the start to the end index of the current contour.
- Use
circshift to shift PL by one position to the left, creating pairs of start and end points for each edge.
- If
cl is false, remove the last row of PL to avoid closing the contour.
- Determine the number of points
nP in PL.
- Fill the Edge List
EL from position k+1 to k+nP with the points in PL.
- Update the counter
k by adding nP.
- Trim the Edge List
EL to include only the filled rows, from 1 to k.
- Extract the first column of
EL to create the list PL of starting points.
Algorithm explaination created using ChatGPT on 2025-08-19 00:22. (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