m3sh.obj.CSType.

bezier#

static CSType.bezier(b, *args)#

Initialize Bézier curve/surface.

Initializes a Bézier curve/surface from its control point array.

Parameters:
b~numpy.ndarray, shape (n+1, d)

Control points of a Bézier curve/surface. For a surface shape should be (m+1, n+1, d), see below for more details.

*args

Variable length argument list. Pass 'func' to disambiguate the case of curves and functional surfaces. Pass 'rational' or 'rat' to indicate that the last of the d coordinate entries of each control point is a weight.

Returns:
CSType

Corresponding Bézier curve/surface representation.

Notes

If we are given weights as last component of control points, a corresponding rational curve is defined according to

\[\begin{split}\mathbf{b}(u) = \\frac{\sum_{i=0}^{n} w_i\mathbf{a}_i B_i^n(u)} {\sum_{i=0}^{n} w_i B_i^n(u)}, \qquad \mathbf{b}_i = (\mathbf{a}_i, w_i)\end{split}\]

and analogously for surfaces.

Examples

Curves. Let \(n \geq 0\). Control points \(\mathbf{b}_0, \dots, \mathbf{b}_{n} \in \mathbb{R}^d\) define a Bézier curve

\[\mathbf{b}(u) = \sum_{i=0}^{n} \mathbf{b}_i B_i^n(u)\]

of degree \(n\) over the interval \([0, 1]\). The control points can be passed by packing them into an array b of shape (n+1, d).

Surfaces. Let \(m \geq 0\) and \(n \geq 0\). A tensor product Bézier surface of degree \((m, n)\) is defined as

\[\mathbf{b}(u,v) = \sum_{i=0}^{m} \sum_{j=0}^{n} \mathbf{b}_{ij} B_i^m(u) B_j^n(v).\]

Control points should be passed as an array b of shape (m+1, n+1, d).