by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.5, Creation date: 2024-11-14, Last change: 2025-09-15
CPLN=CPL2ccw(CPL)
CPL: | CPL with nested CPLS |
CPLN: | CPL with nested CPLS all in ccw |
SGfigure; CPLplotcwccw(CPLsample(38))
SGfigure; CPLplotcwccw(CPL2cw(CPLsample(38)))
SGfigure; CPLplotcwccw(CPLCPL2ccwinvert(CPLsample(38)))
SGfigure; CPLplotcwccw(CPLinvert(CPLsample(38)))
This function, CPL2ccw, is designed to change the orientation of all nested Closed Polygon Lists (CPLs) to counter-clockwise (ccw). It is part of the SolidGeometry library and addresses issues related to the polyshape class.
poly2ccw with the x and y coordinates extracted from the input CPL. This function reorders the vertices to ensure a counter-clockwise orientation.CPLN.nargout==0), the function proceeds to visualize the result:
SGfigure(0,90) is called to set up a figure window with specific parameters.CPLplotcolors is used to plot the CPLN with a red star-line style ('r*-').The function can be called with a sample CPL as follows:
CPL2ccw(CPLsample(44))
This will convert the orientation of the sample CPL to counter-clockwise.
Algorithm explaination created using ChatGPT on 2025-08-18 22:47. (Please note: No guarantee for the correctness of this explanation)