CPLflipud

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

flips one by one the CPL up and down to change the ordner cw / ccw

Description

In contrast to simply calling flipud, this function does not change the order of the contours within CPL.

See Also: , CPLisccwinout , CPLsortinout , CPLisccw , CPLisccwcorrected , CPLsetallcw

Example Illustration

 missing image of CPLflipud(CPL)

Syntax

CPLflipud(CPL)

Input Parameter

CPL: Closed Polygon Line; contours separated by nan nan

Examples


CPLflipud(CPLsample(13))
CPLflipud(flipud(CPLsample(13)))




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, CPLflipud, is designed to flip the order of points in each contour of a Closed Polygon Line (CPL) without altering the sequence of the contours themselves. Below is a detailed explanation of the algorithm and its parameters:

Input Parameters

Algorithm Steps

  1. The function begins by determining the number of separate contours within the CPL using the separateNaN function. This function counts how many distinct contours are present by identifying the nan nan separators.
  2. A copy of the input CPL is made and stored in CPLN to preserve the original data.
  3. A loop iterates over each contour (from 1 to n, where n is the number of contours identified).
  4. Within the loop, for each contour, the function selectNaN is used to extract the specific contour from CPLN.
  5. The extracted contour is then flipped upside down using the flipud function, which reverses the order of the points in the contour.
  6. The flipped contour is then placed back into CPLN at the same position using the replaceNaN function.
  7. After processing all contours, if no output argument is specified (i.e., nargout==0), the function calls CPLisccw to check the orientation of the contours and textCVL to display the contours.

Additional Notes

This function is part of the SolidGeometry library and was introduced in version 4.7. It is specifically designed to handle closed polygon lists, ensuring that the orientation of each contour is flipped without altering the overall structure of the CPL.

Algorithm explaination created using ChatGPT on 2025-08-18 23:30. (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