CPLobjects2cells

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.4, Creation date: 2023-12-20, Last change: 2025-09-15

returns CPL as cell list of CPLs separated by not-overlapping outer-border CPLs

Description

reverse function is: CPLcell2NaN


See Also: CPLsortinout , CPLregions , PSregions , CPLcell2NaN , CPLregions2cell

Example Illustration

 missing image of CPLobjects2cells(CPL)

Syntax

CPLN=CPLobjects2cells(CPL)

Input Parameter

CPL: NaN separated CPL

Output Parameter

CPLN: cell list of CPLs separated by not-overlapping outer-border CPLs

Examples

CPLbox('','A'); A=ans; CPLbox('','B'); B=ans; CPLbox('','C'); C=ans; CPLbox('','D'); D=ans;
CPLbox([70 5],'table'); T=ans;
CPLarrange({A,B,C,D},T,'ontop',1,'add'); CPL=ans; SGfigure; CPSplot(CPL);
CPLobjects2cells(CPL), CPLN=ans;




Copyright 2023-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, CPLobjects2cells, processes a NaN-separated list of closed polygon lists (CPL) and returns a cell list of CPLs that are separated by non-overlapping outer-border CPLs.

Input Parameters

Output Results

Algorithm Steps

  1. Call the function CPLsortinout with CPL as the argument, which returns two arrays, a and b.
  2. Find indices in a where the value is zero using find(a==0), and store them in zz.
  3. Initialize two cell arrays, uu and CPLN, with the number of elements equal to the number of elements in zz.
  4. Iterate over each element in zz:
  5. If no output argument is specified (nargout==0):
Algorithm explaination created using ChatGPT on 2025-08-19 06:48. (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