Syntax
CPR=CPLcutPez(CPL,[cp,ev])
Input Parameter
CPL : | | Closed Polygon List |
cp : | | center Point |
ev : | | unit vector to erase from |
Output Parameter
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
- CPL: A Closed Polygon List that represents the shape to be cut.
- cp: The center point from which the cut is initiated. If not provided, it defaults to the mean of the CPL.
- ev: A unit vector indicating the direction from which the cut is made. Defaults to [-1, 0] if not specified.
Output
- CPR: The resulting contour after the cut has been made.
Algorithm Steps
- Calculate the bounding box of the CPL using
BBofCPL
.
- Determine the center point
cp
from the input or default to the mean of the CPL.
- Determine the erase vector
ev
from the input or default to [-1, 0].
- Calculate the orthogonal vector
ov
to ev
.
- Construct a transformation matrix
T
using ev
, ov
, and cp
.
- Create a bounding box polygon
CPX
using CPLofBB
and scale it by 1.5 times the size of the bounding box.
- Transform
CPX
using the transformation matrix T
with PLtransT
.
- Subtract
CPX
from CPL
using CPLsubtract
to get the cut contour CPR
.
- 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