CPLsortinout

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 3.6, Creation date: 2017-03-11, Last change: 2025-09-14

returns a inside outside sorted CPL (There is a changed behaviour

Description

For laser cutting, the insider first order is required. For automatic detection of corresponding vessels, outside first is important.
Corresponance matrix:
(i,j)==+1 i is inside j, -1== i is outside j, NaN==crossing


See Also: CPLselectinout , connectofmat , selectNaN , separateNaN , CPLisccwinout , svgpolylineofCPL , CPLwriteSVG , CPLsetallcw

Example Illustration

 missing image of CPLsortinout(CPL,in1st)

Syntax

[cind,CC,NCPL,pi]=CPLsortinout([CPL,in1st])

Input Parameter

CPL: Original CPL
in1st: true==inside first; false=outside first; default is true

Output Parameter

cind: level index related to separatedNaN (CPL)
CC: Corresponance matrix
NCPL: New contour list sorted by enclosure order
pi: parent index list [parent level]

Examples


CPLsortinout(selectNaN(CPLsample(14),[1,2,3,6]))
CPLsortinout(selectNaN(CPLsample(14),[1,2,3,6]),false)
[~,CC]=CPLsortinout(CPLsample(14)); c=connectofmat(CC)
CPLselectinout(CPLsample(14),[0 1])




Copyright 2017-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

Last html export of this page out of FM database by TL: 2025-09-21