Bezier curves and surfaces

Memo for myself about the implementation of Bezier curves/surfaces.

They are defined by control points, which are vectors of same dimensions as the output dimension. There are \(order+1\) control points per input dimension, meaning there are \((order+1)^{dimIn}\) control points in total. \(order\) is the 3rd attribute (with the numbers of input and output dimension) defining a Bezier curve/surface.

The evalution of a Bezier curve/surface for a given input \(\overrightarrow{x}\) is equal to the sum of the weighted control points, where the weight of a control point is equal to the product of the weight in each dimension of this control point at the given input. The weight of the \(j\)-th control point in a given dimension \(i\) is equal to \(B(j)*(1-x_i)^{order-j}*x_i^j\), where \(B(j)\) is the \(j\)-th binomial value for \(order\). Binomial values are the Pascal triangle values (\(order\equiv row\)):

Using an array of vectors for the control point, and look up tables for the binomial values and indices of each control point in each dimension allows an efficient implementation of the evaluation of a Bezier curve/surface.

Given that the Bezier curve/surface structure is implemented as follow:

The look up table for the binomial can be prepared as follow:

The loop up table for the control point indices can be prepared as follow:

Then, the CapyBezier object can be instanciated as follow:

and the evaluation method becomes:

2022-02-09
in All, C programming language,
22 views
Copyright 2021-2022 Baillehache Pascal