Syntax
OL=outsidetriangleVL(VL,p1,p2,p3)
Input Parameter
VL : | | Vertex list |
p1 : | | Point 1 of the plane |
p2 : | | Point 2 of the plane |
p3 : | | Point 3 of the plane |
Output Parameter
Examples
outsidetriangleVL ([3 3 0],[0 0 0],[0 10 0],[ 10 0 0 ])
outsidetriangleVL ([3 3 -1],[0 0 0],[0 10 0],[ 10 0 0 ])
outsidetriangleVL ([3 3 +1],[0 0 0],[0 10 0],[ 10 0 0 ])
outsidetriangleVL ([10 10 0],[0 0 0],[0 10 0],[ 10 0 0 ])
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, outsidetriangleVL
, determines the position of vertices relative to a plane defined by three points, p1
, p2
, and p3
. The function returns a list indicating whether each vertex is inside, outside, or on the plane.
Input Parameters
- VL: A list of vertices to be evaluated. Each vertex is a point in 3D space.
- p1: The first point defining the plane.
- p2: The second point defining the plane.
- p3: The third point defining the plane.
Output Results
- OL: A list indicating the position of each vertex relative to the plane. The values can be:
- 1: Inside but below the plane.
- 0: Fully in the plane.
- -1: Inside but above the plane.
- inf: Outside the triangle.
Algorithm Steps
- Calculate the normal vector
ez
of the plane using the cross product of vectors (p2-p1)
and (p3-p1)
.
- Determine the number of vertices
n
in the list VL
.
- Initialize the output list
OL
with zeros, having the same length as the number of vertices.
- Iterate over each vertex in
VL
:
- For each vertex, call the function
intersectstriangle
with the current vertex, the normal vector ez
, and the points p1
, p2
, and p3
.
- Store the result in the corresponding position in the output list
OL
.
Example Usage
Here are some example calls to the function:
outsidetriangleVL([3 3 0],[0 0 0],[0 10 0],[10 0 0])
outsidetriangleVL([3 3 -1],[0 0 0],[0 10 0],[10 0 0])
outsidetriangleVL([3 3 +1],[0 0 0],[0 10 0],[10 0 0])
outsidetriangleVL([10 10 0],[0 0 0],[0 10 0],[10 0 0])
Algorithm explaination created using ChatGPT on 2025-08-19 01:35. (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