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
CPLN=CPLcell2NaN(CPL)
CPL: | Cell list of CPLs |
CPLN: | CPL that is a simple concatenation of all contours in CPL |
if ~exist('A') || ~exist('B') || ~exist('C') || ~exist('D') || ~exist('S') || ~exist('T')
CPLbox('','A'); A=ans; CPLbox('','B'); B=anCPLs; CPLbox('','C'); C=ans; CPLbox('','D'); D=ans;
CPLbox([10 5],'space'); S=ans; CPLbox([70 5],'table'); T=ans;
end
CPLarrange({A,B,C,S},T,'ontop',1,'add'); CPL=ans; SGfigure; CPSplot(CPL);
CPLC=CPLobjects2cells(CPL)
CPLcell2NaN(CPLC)
This function, CPLcell2NaN, is designed to concatenate a cell list of closed polygon lists (CPLs) into a single CPL. It is part of the SolidGeometry library.
CPL, separated by NaN values.CPL is a cell array. If not, return CPL as CPLN.CPL is a cell array, initialize an empty array CPLN.CPL cell array:[NaN NaN] followed by the element's data to CPLN.CPLN to eliminate the initial [NaN NaN] row.CPLN using SGfigure and CPLplot.The example provided in the code demonstrates how to create several CPLs using CPLbox, arrange them with CPLarrange, convert them to a cell list with CPLobjects2cells, and finally concatenate them using CPLcell2NaN.