Syntax
[SEL,l,o]=convexEL(p1,p2,p3,VL,EL)
Input Parameter
p1 : | | p1 of the corresponding convex triangle |
p2 : | | p2 of the corresponding convex triangle |
p3 : | | p3 of the corresponding convex triangle |
VL : | | Vertex list |
EL : | | Unsorted edge list |
Output Parameter
SEL : | | sorted edge list |
l : | | index list for each new contour segment |
o : | | number of contour segments |
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 sort a list of edges in a convex order. It is an auxiliary procedure that takes twice the time of the `sortEL` function. The function `convexEL` takes several input parameters and returns a sorted edge list, an index list for each new contour segment, and the number of contour segments.
Input Parameters
- p1, p2, p3: These are the vertices of the corresponding convex triangle.
- VL: The vertex list, which contains the coordinates of the vertices.
- EL: The unsorted edge list, which contains pairs of vertex indices representing edges.
Output Results
- SEL: The sorted edge list.
- l: An index list for each new contour segment.
- o: The number of contour segments.
Algorithm Steps
- Call the `sortEL` function to sort the edge list `EL`. This function returns the sorted edge list, an index list `indlist`, and the number of contour segments `o`.
- Determine the number of edges `n` and extend `indlist` by appending `n+1` to it.
- Convert the vertex list `VL` from Cartesian to barycentric coordinates with respect to the triangle defined by `p1`, `p2`, and `p3` using the `carttobaryVL` function.
- Iterate over each contour segment (from 1 to `o`):
- Determine the start `a` and end `e` indices of the current contour segment using `indlist`.
- Create a list `CEL` of vertex indices for the current contour segment, including the last vertex to close the loop.
- Extract the corresponding barycentric coordinates `PL` for the vertices in `CEL`.
- Determine the number of points `nP` in the current contour segment.
- Check the orientation of the contour segment by calculating the signed area `S` for each point:
- If `S` is negative for any point, the contour is not oriented correctly, and the edge list for this segment is reversed.
- After processing all contour segments, call `sortEL` again to ensure the final edge list `SEL` is sorted correctly.
Algorithm explaination created using ChatGPT on 2025-08-19 00:54. (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