CPLsetallcw

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.7, Creation date: 2019-07-05, Last change: 2025-09-14

sets all contours of a CPL to cw

Description

this function can be used to show the effect of polybuffer or polyshape

See Also: CPLisccwinout , CPLsortinout , CPLisccw , CPLisccwcorrected

Example Illustration

 missing image of CPLsetallcw(CPL)

Syntax

CPL=CPLsetallcw(CPL)

Input Parameter

CPL: CPL

Output Parameter

CPL: CPL with all polygons in cw

Examples


CPL=CPLsample(13)
CPLisccw(CPL)
CPLsetallcw(CPL); X=ans;
CPLbuffer(X,.5)




Copyright 2019-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, CPLsetallcw, is designed to ensure that all contours in a Closed Polygon List (CPL) are oriented clockwise (cw).

Input Parameters

Output

Algorithm Steps

  1. Call the function CPLisccw with the input CPL to determine the orientation of each polygon in the list. This function returns an array a where each element is a boolean indicating if the corresponding polygon is counter-clockwise (ccw).
  2. Determine the number of polygons in the list using numel(a) and store it in n.
  3. Iterate over each polygon using a for-loop from 1 to n:
  4. After processing all polygons, check if the function is called with an output argument. If not (i.e., nargout == 0), call CPLisccw(CPL) to display the orientation status of the polygons.

Example Usage

The example provided demonstrates how to use the function:

  1. Create a sample CPL using CPLsample(13).
  2. Check the orientation of the polygons with CPLisccw(CPL).
  3. Set all polygons to clockwise using CPLsetallcw(CPL).
  4. Buffer the polygons with CPLbuffer(X, 0.5) to visualize the effect.
Algorithm explaination created using ChatGPT on 2025-08-18 23:14. (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