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
- ELo: This is the input edge list or facet list. It is a matrix where each row represents an edge, defined by two vertex indices.
- remeq (optional): A boolean parameter that, when true, removes degenerated edges (edges where both vertices are the same, e.g., [i i]). The default value is false.
Output
- EL: The output is an edge list sorted by the first vertex index, with duplicates removed.
Algorithm Steps
- Initialize
remeq
to false. If a second argument is provided and is not empty, set remeq
to the value of this argument.
- 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
.
- Sort each row of
EL
to ensure consistent ordering of vertex indices within each edge.
- Use the
unique
function to remove duplicate edges, maintaining the original order ('stable' option).
- Identify edges where the original order was reversed during sorting and restore the original direction for these edges.
- 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