Syntax
CPLN=CPLobjects2cells(CPL)
Input Parameter
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
- CPL: A NaN-separated list of closed polygon lists.
Output Results
- CPLN: A cell list of CPLs separated by non-overlapping outer-border CPLs.
Algorithm Steps
- Call the function
CPLsortinout
with CPL
as the argument, which returns two arrays, a
and b
.
- Find indices in
a
where the value is zero using find(a==0)
, and store them in zz
.
- Initialize two cell arrays,
uu
and CPLN
, with the number of elements equal to the number of elements in zz
.
- Iterate over each element in
zz
:
- For each index
i
, create a list uu{i}
that includes the current index zz(i)
and any indices where b(zz(i),:)
is greater than zero.
- Use the function
selectNaN
to select parts of CPL
based on uu{i}
and store the result in CPLN{i}
.
- If no output argument is specified (
nargout==0
):
- Determine the number of elements in
CPLN
and store it in n
.
- Call
SGfigure
with parameters 0
and 90
.
- Iterate over each element in
CPLN
and plot it using CPSplot
with a color determined by colofn(i)
.
- Add an annotation to the plot indicating the number of objects using
plotannotation
.
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