ELunique

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - EL/Edge Lists
Introduced first in SolidGeometry 4.0, Creation date: 2017-07-05, Last change: 2025-09-14

returns a unique list of all edges

Description

Makes sure that no edge is used twice!
More or less the same as ELuniqueofFL but will not change the ordner and in case of doubles the direction of the first used edges is not changed.

See Also: ELuniqueofFL , FLunique

Example Illustration

 missing image of ELunique(ELo,remeq)

Syntax

EL=ELunique(ELo,[remeq])

Input Parameter

ELo: Edge List or Facet List
remeq: removes degenerated edges [i i]; default is false;

Output Parameter

EL: Edge list sorted by first vertex index

Examples


EL=[2 1;2 3;4 5;1 2; 2 1; 3 4; 6 5; 5 1]; ELunique(EL)
ELunique([4 4;4 5; 5 4; 6 4],true)




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, ELunique, processes an edge list to ensure that no edge is used twice, maintaining the order and direction of the first occurrence of each edge. It is part of the SolidGeometry library.

Input Parameters

Output

Algorithm Steps

  1. Initialize remeq to false. If a second argument is provided and is not empty, set remeq to the value of this argument.
  2. Check the number of columns in ELo:
    • If ELo has 3 columns, it is treated as a facet list. Convert it to an edge list by extracting edges from each facet: [1st, 2nd], [2nd, 3rd], and [3rd, 1st] vertices.
    • If ELo has 2 columns, it is already an edge list, so assign it directly to EL.
  3. Sort each row of EL to ensure consistent ordering of vertex indices within each edge.
  4. Use the unique function to remove duplicate edges, maintaining the original order ('stable' option).
  5. Identify edges where the original order was reversed during sorting and restore the original direction for these edges.
  6. If remeq is true, remove any degenerated edges where both vertices are the same.

Example Usage

Example 1: EL=[2 1;2 3;4 5;1 2; 2 1; 3 4; 6 5; 5 1]; ELunique(EL)

Example 2: ELunique([4 4;4 5; 5 4; 6 4],true)

Algorithm explaination created using ChatGPT on 2025-08-19 00:47. (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