CPLsortC

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

returns a contour that start with angle -pi

Description

The contour is resorted around its center. It starts afterwards with the minimal (ctype='min') angle, the angle nearest to zero (ctype='zero'), or the maximum angle (ctype='max'). Often is is important to take only points of the convex hull (for example in case of spirals). Therefore, then only points are selected from the convex hull for the nearest angle to zero (ctype='czero') on the convex hull or the minimal angle value of the convex hull (type='cmin').

To resort the points backwards, use: circshift(CPS,[s 0])
To compare results use: [A circshift(B,[s 0])]

Example Illustration

 missing image of CPLsortC(CPL,ctype,CA)

Syntax

[CPS,WA,CA,s]=CPLsortC(CPL,[ctype,CA])

Input Parameter

CPL: Original CPL
ctype: 'zero','min','max', 'czero', 'cmin'; default is 'czero'
CA: Optional Center Point; do not use it

Output Parameter

CPS: Resorted CPL
WA: corresponding angle
CA: Center of CPL
s: circshift value to return

Examples


CPLsortC(PLstar(10,10))
CPLsortC(CPLspiral(10,20,4*pi+pi/3))




Copyright 2015-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

Last html export of this page out of FM database by TL: 2025-09-21