CPL2cw
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
changes the orientation of all nested CPLs to cw
Description
Because of some unclear changes between the polyshape class, this function is required to compare
See Also: , CPL2ccw
, CPLinvert
Example Illustration
Syntax
CPLN=CPL2cw(CPL)
Input Parameter
CPL: | | CPL with nested CPLS |
Output Parameter
CPLN: | | CPL with nested CPLS all in cw |
Examples
SGfigure; CPLplotcwccw(CPLsample(44))
SGfigure; CPLplotcwccw(CPL2cw(CPLsample(44)))
SGfigure; CPLplotcwccw(CPLCPL2ccwinvert(CPLsample(4)))
SGfigure; CPLplotcwccw(CPLinvert(CPLsample(44)))
Copyright 2024-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, CPL2cw, is designed to change the orientation of all nested closed polygon lists (CPLs) to clockwise (cw). It is part of the SolidGeometry library and was introduced in version 5.5.
Input Parameters
- CPL: A matrix representing a closed polygon list with nested CPLs. Each row in the matrix represents a vertex of the polygon, with the first column containing the x-coordinates and the second column containing the y-coordinates.
Output Results
- CPLN: A matrix similar to the input CPL, but with all nested CPLs oriented in a clockwise direction.
Algorithm Steps
- The function begins by calling the
poly2cw function, which takes the x and y coordinates of the CPL and returns them oriented in a clockwise direction. The output is stored in variables x and y.
- The function then constructs the output matrix
CPLN by combining the x and y vectors into a two-column matrix.
- If no output argument is specified (i.e.,
nargout==0), the function will plot the resulting CPLN using the SGfigure and CPLplotcolors functions. The plot is displayed with a red star marker and line style ('r*-').
Example Usage
The function can be called with a sample CPL as follows:
CPL2cw(CPLsample(44))
This will convert the orientation of the CPL sample with ID 44 to clockwise.
Algorithm explaination created using ChatGPT on 2025-08-18 22:41. (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