CPLunsort

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 5.1, Creation date: 2021-08-06, Last change: 2025-09-15

changes the order of nan separated CPL using unsortNaN

Description

Mainly for testing other function such as CPLregions

See Also: unsortNaN , ELunsort , unsortrows

Example Illustration

 missing image of CPLunsort(CPL)

Syntax

CPLU=CPLunsort(CPL)

Input Parameter

CPL: Original CPL

Output Parameter

CPLU: THe order of Conturs has changed

Examples


CPLunsort(CPLsample(27))




Copyright 2021-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, CPLunsort, is designed to change the order of contours in a Closed Polygon List (CPL) by using another function called unsortNaN. It is primarily used for testing other functions like CPLregions.

Input Parameters

Output Results

Algorithm Steps

  1. The function takes a Closed Polygon List (CPL) as input.
  2. It calls the function unsortNaN with the input CPL to reorder the contours. The result is stored in CPLU.
  3. If no output argument is specified (i.e., nargout==0), the function will generate a figure to visually compare the original and unsorted CPLs.
  4. The figure is set up with two subplots:
    • The first subplot displays the original CPL using CPLplotcwccw and textCPL to annotate it. The view is set to a top-down perspective with equal axis scaling and a grid.
    • The second subplot displays the unsorted CPL in the same manner as the first subplot.

Example Usage

An example call to the function is CPLunsort(CPLsample(27)), which would reorder the contours of the sample CPL with ID 27.

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