CPLselectbyP

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.0, Creation date: 2020-10-04, Last change: 2025-09-14

returns an index list to select enclosing CPLs

Description

should be renamed to CPLselectbyenclosedP in future

See Also: crosstest , insideCPL , insideCPS , isInteriorofCPL , CPLselectbynearestP

Example Illustration

 missing image of CPLselectbyP(CPL,PL);

Syntax

ind=CPLselectbyP(CPL,PL);

Input Parameter

CPL: CPL
PL: Single point to check

Output Parameter

ind: index list

Examples


CPLselectbyP(CPLsample(14),[0 0 0])
CPLselectbyP(CPLsample(14),[5 0 0])
CPLselectbyP(CPLsample(14),[5 0 ;10 -3])




Copyright 2020-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, CPLselectbyP, is designed to determine which closed polygons (CPLs) from a list enclose a given set of points (PL). It returns an index list indicating which polygons enclose the points.

Input Parameters

Output

Algorithm Steps

  1. Use separateNaN to determine the number of polygons (n) and their boundaries (b) within the CPL list.
  2. Initialize an index list ind with zeros, having a length equal to the number of polygons.
  3. Iterate over each point in PL:
  4. If no output is requested (nargout == 0), visualize the results:
Algorithm explaination created using ChatGPT on 2025-08-19 01:38. (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