splinepy.bezier.Bezier#

class splinepy.bezier.Bezier(degrees=None, control_points=None, spline=None)[source]#

Bases: BezierBase

Bezier (Spline).

Passes all arguments to super.__init__(), see BezierBase.

We can distinguish between different types of splines depending on the dimension of the parametric space.

Note

For simplicity, we restrict ourselves to the three most common types of splines in the following, namely curves, surfaces and volumes, although splinepy also supports higher dimensions, see the documentation of Spline for more information.

1. A spline of degree \(p\) with \((p+1)\) control points \(P^i\in\mathbb{R}^{N_{phys}}\) and a one-dimensional parameter space (i.e., \(N_{param}=1\)) corresponds to a line embedded into the physical space:

\[C(u) = \sum_{i=0}^{l} B^{i;p}(u) P^i\]

2. A spline of degrees \(p,q\) with \((p+1)\cdot(q+1)\) control points \(P^{i,j}\in\mathbb{R}^{N_{phys}}\) and a two-dimensional parameter space (i.e., \(N_{param}=2\)) corresponds to a surface, embedded into the physical space:

\[S(u,v) = \sum_{i=0}^{l} \sum_{j=0}^{m} B^{i;p}(u) B^{j;q}(v) P^{i,j}\]

Due to the tensor-product nature of the Bezier basis functions, this is often rewritten as in terms of multi-variate basis functions

\[\tilde{B}^{i,j;p,q}(u,v) := B^{i;p}(u) B^{j;q}(v)\]

3. A spline of degrees \(p,q,r\) with \((p+1)\cdot(q+1)\cdot(r+1)\) control points \(P^{i,j,k}\in\mathbb{R}^{N_{phys}}\) and a three-dimensional parameter space (i.e., \(N_{param}=3\)) corresponds to a volume, embedded into the physical space:

\[V^B(u,v,w) = \sum_{i=0}^{l} \sum_{j=0}^{m} \sum_{k=0}^{n} B^{i;p}(u) B^{j;q}(v) B^{k;r}(w) P^{i,j,k}\]

Here, we can introduce the multi-variate basis functions

\[\tilde{B}^{i,j,k;p,q,r}(u,v,w) := B^{i;p}(u) B^{j;q}(v) B^{k;r}(w)\]

Higher-dimensional instances are constructed accordingly.

Usage:

# Polynomial Bezier surface
polynomial_bezier = splinepy.Bezier(
    degrees=[2, 1],
    control_points=[
        [0.0, 0.0],
        [1.0, 0.0],
        [2.0, 1.0],
        [0.0, 2.0],
        [1.0, 1.0],
        [2.0, 2.0],
    ],
)
Parameters:
  • degrees ((para_dim,) list-like)

  • control_points ((m, dim) list-like)

Return type:

None

Methods

Bezier.basis(queries[, nthreads])

Returns basis function values on the supports of given queries.

Bezier.basis_and_support(queries[, nthreads])

Returns basis function values and their support ids of given queries.

Bezier.basis_derivative(queries, orders[, ...])

Returns derivative of basis functions evaluated on the supports of given queries.

Bezier.basis_derivative_and_support(queries, ...)

Returns derivative of basis functions and their support ids of given queries.

Bezier.clear()

Clears core spline and saved data

Bezier.compose(inner_function[, ...])

Calculates the spline that forms the composition of the inner function spline (function argument), using the caller spline as the outer (or deformation function).

Bezier.composition_derivative(inner, ...)

Derivative of composition when given the differentiated inner function with constant outer function.

Bezier.copy([saved_data])

Returns deepcopy of stored data and newly initialized self.

Bezier.current_core_properties(self)

Bezier.derivative(queries, orders[, nthreads])

Evaluates derivatives of spline.

Bezier.derivative_spline(orders)

Calculates the spline that describes the requested derivative in a close-form representation of the the same spline-type.

Bezier.elevate_degrees(parametric_dimensions)

Elevate degree.

Bezier.evaluate(queries[, nthreads])

Evaluates spline.

Bezier.export(fname)

Export spline.

Bezier.extract_dim(dim)

Extracts a single physical dimension of a spline.

Bezier.greville_abscissae([duplicate_tolerance])

Returns greville abscissae.

Bezier.jacobian(queries[, nthreads])

Evaluates jacobians on spline.

Bezier.mapper(reference)

Retrieve a mapper that can be used to get physical derivatives such as a gradient or hessian in physical space

Bezier.proximities(queries[, ...])

Given physical coordinate, finds a parametric coordinate that maps to the nearest physical coordinate.

Bezier.reduce_degrees(parametric_dimensions)

Tries to reduce degree.

Bezier.sample(resolutions[, nthreads])

Uniformly sample along each parametric dimensions from spline.

Bezier.show(**kwargs)

Equivalent to

Bezier.showable(**kwargs)

Equivalent to

Bezier.split(para_dim, locations)

Splits spline at given locations along the given para_dim.

Bezier.support(queries[, nthreads])

Returns basis support ids of given queries.

Bezier.todict([tolist])

Return current spline as dict.

Attributes

Bezier.bezier

Bezier.bspline

Bezier.nurbs

Bezier.rationalbezier