CPLrepair

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

returns a CPL for extrusion - finding, duplicating and separating split points (required for SGLib 5.4)

Description

Based on polyshape.simplify.
Simplify (2019a): true of polyshape cuts overlapping contours into closed contour with cross point
SolidBoundaryOrientation (2019a): ccw will make hte outerboundart ccw and the inner cw
This function CPLrepair is older than 2019a and separates the crosspoints and removes them from each other. Important for XOR.
In 2024 for SGLib 5.4 the concept before splitting the contours is:
ps=polyshape(OCPL,'Simplify',true,'KeepCollinearPoints',true);
ps=ps.sortboundaries('ascend');
CPL=flipud(ps.Vertices);

If two overlapping circles are called as arguments, the overlapping areas are excluded from polyshape. Intersection points are generated and two new moon curves are created,

See Also: , CPLrecontour , CPLmeltbool , CPLisccwcorrected

Example Illustration

 missing image of CPLrepair(OCPL,dd)

Syntax

[CPL,NP]=CPLrepair(OCPL,[dd])

Input Parameter

OCPL: Original Contour line
dd: resolution for shifted points; default is 1e-6;

Output Parameter

CPL: Closed
NP: Split point coordinates; not acceicbal

Examples


PLA=[PLcircle(4); nan nan; PLcircle(4)+3];
CPLrepair(PLA); CVLplot(ans); view(0,90);
CPL=[PLcircle(10);nan nan;PLcircle(10)+4; nan nan; flipud(PLcircle(2))];
CPLrepair(PLA); CVLplot(ans); view(0,90);

CPL=CPLsample(43); CPLrepair(CPL);




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