Syntax
[AVL,AEL]=intersectcontour(TL,p1,p2,p3)
Input Parameter
TL : | | Intersection matrix of a triangle p1p2p3 |
p1 : | | Point 1 |
p2 : | | Point 2 |
p3 : | | Point 3 |
Output Parameter
AVL : | | Vertex list of the crossing points of the triangel |
AEL : | | Edge list of the crossing points of the triangel |
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 function, intersectcontour
, is designed to compute the intersection points and edges of a triangle defined by three points (p1, p2, p3) and an intersection matrix (TL). The function returns a vertex list (AVL) and an edge list (AEL) of the crossing points of the triangle.
Input Parameters
- TL: Intersection matrix of a triangle defined by points p1, p2, and p3. It contains information about the intersection of the triangle's edges with some other structure.
- p1: Coordinates of the first point of the triangle.
- p2: Coordinates of the second point of the triangle.
- p3: Coordinates of the third point of the triangle.
Output Results
- AVL: Vertex list of the crossing points of the triangle. It includes a fourth column indicating whether a point comes from inside or outside.
- AEL: Edge list of the crossing points of the triangle. It includes a third column explaining how many walls have been before this line.
Algorithm Steps
- Initialize an empty list
AVL
to store the vertices.
- Compute the intersection points between the edges of the triangle and the structure defined by
TL
using the helper function lsegment
:
- For edge p1-p2, use columns 2 and 8 of
TL
.
- For edge p2-p3, use columns 3 and 9 of
TL
.
- For edge p3-p1, use columns 4 and 10 of
TL
.
- Concatenate the results of each
lsegment
call to AVL
.
- Reorder
AVL
to ensure the first row is the last vertex, followed by the rest.
- Compute
SAVL
by combining pairs of rows from AVL
and summing their fourth columns.
- Update
AVL
with SAVL
.
- Determine the number of vertices
n
and create an edge list AEL
connecting consecutive vertices, closing the loop by connecting the last vertex to the first.
- Append the fourth column of
AVL
to AEL
to indicate the number of walls before each line.
- Initialize a fourth column in
AEL
with zeros and update it to accumulate the number of walls.
- Reorder the fourth column of
AEL
to ensure continuity.
- Return the final
AVL
and AEL
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:33. (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