CPLBezier

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

returns Bezier Curves from CPLs



See Also: VLBezierC , CPLfft

Example Illustration

 missing image of CPLBezier(CPL,ns);

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

Output

Algorithm Steps

  1. Determine the number of Bezier coefficients, ns, using the function getfuncparams. If not specified, it defaults to 100.
  2. Use separateNaN to determine the number of separate polygon lists in CPL.
  3. Initialize an empty array CPLB to store the resulting Bezier curves.
  4. 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.
  5. Remove the last NaN NaN separator from CPLB.
  6. 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

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