outsidetriangleVL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Geometric Queries
Introduced first in SolidGeometry 1.0, Creation date: 2012-08-04, Last change: 2025-09-14

returns whether a vertex/vertex list is below or above or outside a 3P triangle

Description

1 = inside but below the plane spanned by three points p1, p2, p3
0 = fully in the plane spanned by three points p1, p2, p3
-1 = inside but above the plane spanned by three points p1, p2, p3
inf = outside the triangle

See Also: outsidetriangleVL , intersectstriangle

Example Illustration

 missing image of outsidetriangleVL(VL,p1,p2,p3)

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

OL: Outside List

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

Output Results

Algorithm Steps

  1. Calculate the normal vector ez of the plane using the cross product of vectors (p2-p1) and (p3-p1).
  2. Determine the number of vertices n in the list VL.
  3. Initialize the output list OL with zeros, having the same length as the number of vertices.
  4. 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:

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