VLBezierC

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Analytical Geometry
Introduced first in SolidGeometry 1.0, Creation date: 2012-05-17, Last change: 2025-09-14

returns a Bezier curve for a given list of points



See Also: VLBezier4P

Example Illustration

 missing image of VLBezierC(p,k)

Syntax

val=VLBezierC(p,k)

Input Parameter

p: Vertex list
k: number of points of the Bezier curve

Output Parameter

val: Vertex list of the Bezier curve

Examples

PL=[0 0 0; 5 0 0; 5 5 0; 0 10 0; 0 15 0; 15 15 10]
VL=VLBezierC(PL,20); VLFLfigure; VLplot(VL), hold on; VLplot (PL)




Copyright 2012-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 algorithm generates a Bezier curve from a given list of points. It is implemented in the function VLBezierC and is part of the SolidGeometry library.

Input Parameters

Output

Algorithm Steps

  1. Determine the number of input vertices n from the size of VL.
  2. Set the default number of points k to the number of input vertices unless specified otherwise.
  3. Initialize the range a to 0 and b to k-1.
  4. Create a vector y that spans from 0 to b.
  5. Initialize a matrix BVL to store the calculated Bezier curve points.
  6. If the input vertices are in 2D, extend them to 3D by adding a zero z-coordinate.
  7. Separate the x, y, and z coordinates of the input vertices into matrices X, Y, and Z.
  8. For each point j in the range of y:
    • Iterate over each vertex i from 2 to n:
    • Calculate the new coordinates using the Bezier formula:
      • X(i:n,i) = (b-y(j))/(b-a)*X(i-1:n-1,i-1) + (y(j)-a)/(b-a)*X(i:n,i-1)
      • Y(i:n,i) = (b-y(j))/(b-a)*Y(i-1:n-1,i-1) + (y(j)-a)/(b-a)*Y(i:n,i-1)
      • Z(i:n,i) = (b-y(j))/(b-a)*Z(i-1:n-1,i-1) + (y(j)-a)/(b-a)*Z(i:n,i-1)
  9. Store the final calculated point in BVL.
  10. If no output is requested, plot the original vertices and the calculated Bezier curve.
Algorithm explaination created using ChatGPT on 2025-08-19 06:42. (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