crossedgeVL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analyzing function
Introduced first in SolidGeometry 1.0, Creation date: 2012-05-05, Last change: 2025-09-14

returns whether a 2D line crosses a 2D contour

Description

The procedure gets a sorted vertex list as contour and 3 indices of a facet. ONLY if the 3 indices are not successive, whether a line of two not successive points cross any other line. The contour itself is may concave is not allowed to cross itself. The function uses cross4P for detection.

Example Illustration

 missing image of crossedgeVL(VL,k0,k1,k2)

Syntax

[i,j]=crossedgeVL(VL,k0,k1,k2)

Input Parameter

VL: Vertex list
k0: Index 0
k1: Index 1
k2: Index 2

Output Parameter

i: index of the beginning of the crossed line
j: index of the end of the crossed line, ie. i+1




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 determines if a line segment defined by three indices crosses any other line segment in a 2D contour. The contour is represented by a sorted vertex list, and the function checks for intersections using the helper function cross4P.

Input Parameters

Output Results

Algorithm Steps

  1. Initialize i to 0.
  2. Check if any of the line segments formed by the indices k0, k1, k2 cross the contour using crossC2P. If a crossing is detected, set i to the corresponding index.
  3. Return if a crossing is found at this stage.
  4. Determine the number of vertices n. If n is less than 4, set CI to 0 and return.
  5. Reorder the indices K to ensure they are not successive.
  6. Extract the points p0, p1, p2 from the vertex list using the indices k0, k1, k2.
  7. Check if the indices form a real sequence. If they do, set i and j to 0 and return.
  8. Iterate over each vertex in the contour:
  9. If no crossing is found, set i and j to 0.
Algorithm explaination created using ChatGPT on 2025-08-19 07:55. (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