Syntax
CPLB=CPLBezier(CPL,[ns]);
Input Parameter
CPL : | | CPL |
ns : | | number of Beziercoefficients |
Output Parameter
CPLB : | | Contours of CPL as Bezier Curves |
Examples
CPLBezier(CPLsample(12),5);
CPLBezier(PLtransT(CPLsample(12),TofR(rot(10),[30 30])),5);
CPLBezier(PLtransT(CPLsample(12),TofR(rot(10),[30 30])),100);
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
Algorithm (Workflow)
This function, CPLBezier
, converts Closed Polygon Lists (CPL) into Bezier curves. It is part of the SolidGeometry library and was introduced in version 4.4.
Input Parameters
- CPL: The Closed Polygon List that needs to be converted into Bezier curves.
- ns: The number of Bezier coefficients. This is an optional parameter, and if not provided, it defaults to 100.
Output
- CPLB: The contours of the CPL represented as Bezier curves.
Algorithm Steps
- Determine the number of Bezier coefficients,
ns
, using the function getfuncparams
. If not specified, it defaults to 100.
- Use
separateNaN
to determine the number of separate polygon lists in CPL
.
- Initialize an empty array
CPLB
to store the resulting Bezier curves.
- Iterate over each polygon list in
CPL
:
- Extract the
i
-th polygon list using separateNaN
.
- Convert this polygon list into a Bezier curve using
VLBezierC
with ns
coefficients.
- Append the resulting Bezier curve to
CPLB
, followed by a NaN NaN
separator.
- Remove the last
NaN NaN
separator from CPLB
.
- If no output is requested (
nargout==0
), plot the Bezier curves and the original CPL:
- Use
SGfigure
to create a new figure.
- Plot the Bezier curves in red using
CPLplot
.
- Plot the original CPL in green using
CPLplot
.
Example Usage
CPLBezier(CPLsample(12),5);
- Converts a sample CPL with 12 points into Bezier curves with 5 coefficients.
CPLBezier(PLtransT(CPLsample(12),TofR(rot(10),[30 30])),5);
- Transforms a sample CPL and converts it into Bezier curves with 5 coefficients.
CPLBezier(PLtransT(CPLsample(12),TofR(rot(10),[30 30])),100);
- Transforms a sample CPL and converts it into Bezier curves with 100 coefficients.
Algorithm explaination created using ChatGPT on 2025-08-18 23:51. (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