CILofOEL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 1.1, Creation date: 2013-08-16, Last change: 2025-09-14

returns contour index list for a SORTED edge list of several consecutive open contours

Description

works with closed AND open contour edge lists which have to be SORTED first !
CILofCEL CIL of contour edge list - CILofOEL CIL of open edge list ELreconnect

Example Illustration

 missing image of CILofOEL(EL)

Syntax

[CIL,ci,pi]=CILofOEL(EL)

Input Parameter

EL: Edge list

Output Parameter

CIL: Contour index list
ci: real closed contur index list (without points)
pi: single point contour index list

Examples

Used in EXP-2013-08-13
EL=[ELofn(3);ELofn(4)+3;ELofn(1)+5+3]
UEL=[ELunsort(EL);EL]; [CIL,ci,pi]=CILofOEL(UEL)




Copyright 2013-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 processes a sorted edge list to identify and categorize contours. It is designed to work with both closed and open contour edge lists. The function returns a contour index list, a real closed contour index list, and a single point contour index list.

Input Parameters

Output Results

Algorithm Steps

  1. Initialize variables: Determine the number of edges n in the edge list EL. Create a zero matrix CIL with n rows and 2 columns. Set a counter k to zero.
  2. Iterate over each edge in the edge list using a loop from 1 to n.
  3. For each edge, check if it is the first edge or if it does not connect to the previous edge. If true, increment k and set the start index of the current contour in CIL.
  4. If the current edge is not the first edge, set the end index of the previous contour in CIL.
  5. If the current edge is a single point (start and end nodes are the same), set the end index of the current contour in CIL.
  6. After the loop, set the end index of the last contour in CIL to n.
  7. Adjust the length of CIL to include only the filled rows.
  8. Determine the closed contours by checking if the start node of a contour matches the end node of the same contour. Store the result in ci.
  9. Identify single point contours by checking if the start and end indices of a contour are the same and if it is a closed contour. Store the result in pi.
  10. Update ci to exclude single point contours, ensuring it only contains real closed contours.
Algorithm explaination created using ChatGPT on 2025-08-19 00:56. (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