Syntax
[c,pc]=iscrossingCPL(CPLA,[CPLB,touch])
Input Parameter
CPLA : | | Closed polygon A |
CPLB : | | Closed polygon B |
touch : | | check touch instead of cross; default is true |
Output Parameter
c : | | true/false |
pc : | | first detected crossing point |
Examples
PL=VLui; iscrossingCPL(PL(:,1:2),[],false)
Copyright 2015-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, iscrossingCPL
, checks if two closed polygon lists (CPLs) intersect or touch each other. It is part of the SolidGeometry library and was developed by Tim Lueth.
Input Parameters
- CPLA: The first closed polygon list.
- CPLB: The second closed polygon list. If not provided, it defaults to
CPLA
.
- touch: A boolean indicating whether to check for touching instead of crossing. The default value is
true
.
Output Results
- c: A boolean value indicating if the polygons cross or touch.
- pc: The first detected crossing point, if any.
Algorithm Steps
- Check if
CPLB
is provided; if not, set it to CPLA
.
- Set
touch
to true
unless specified otherwise.
- Convert
CPLA
and CPLB
to closed polygon lists using CPLofPL
.
- Determine the number of points in
CPLB
.
- Iterate over each segment of
CPLB
:
- Use
PLcrossCPLline
to check for intersections between CPLA
and each segment of CPLB
.
- If an intersection is found, set
c
to true
and break the loop.
- If no intersection is found, set
c
to false
.
- If no output arguments are specified, plot the polygons and any intersection points using
SGfigure
, CPLplot
, and PLplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:41. (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