CPLcutPez

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

cuts a CPL along a border line



See Also: CPLsubtract

Example Illustration

 missing image of CPLcutPez(CPL,cp,ev)

Syntax

CPR=CPLcutPez(CPL,[cp,ev])

Input Parameter

CPL: Closed Polygon List
cp: center Point
ev: unit vector to erase from

Output Parameter

CPR: cutted contour

Examples


CPLcutPez(PLcircle(10),[-2 0],[-1 2]);
CPLcutPez(CPLsample(12),[-2 0],[-1 2]);




Copyright 2022-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, CPLcutPez, is designed to cut a Closed Polygon List (CPL) along a specified border line. It is part of the SolidGeometry library and was introduced in version 5.1.

Input Parameters

Output

Algorithm Steps

  1. Calculate the bounding box of the CPL using BBofCPL.
  2. Determine the center point cp from the input or default to the mean of the CPL.
  3. Determine the erase vector ev from the input or default to [-1, 0].
  4. Calculate the orthogonal vector ov to ev.
  5. Construct a transformation matrix T using ev, ov, and cp.
  6. Create a bounding box polygon CPX using CPLofBB and scale it by 1.5 times the size of the bounding box.
  7. Transform CPX using the transformation matrix T with PLtransT.
  8. Subtract CPX from CPL using CPLsubtract to get the cut contour CPR.
  9. If no output is requested, plot the original CPL, the transformed CPX, and the resulting CPR using SGfigure and CPSplot.

Example Usage

To cut a circle with a radius of 10 along a specified line:

CPLcutPez(PLcircle(10), [-2 0], [-1 2]);

To cut a sample CPL with 12 points:

CPLcutPez(CPLsample(12), [-2 0], [-1 2]);
Algorithm explaination created using ChatGPT on 2025-08-18 23:56. (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