splinepy.bspline.BSpline#
- class splinepy.bspline.BSpline(degrees=None, knot_vectors=None, control_points=None, spline=None)[source]#
Bases:
BSplineBase
BSpline.
Passes all arguments to
super.__init__()
, seeBSplineBase
.With the help of the mono-variate basis functions introduced from the B-Spline introduction in
BSplineBase
, we can now construct B-Splines.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 ofSpline
for more information.1. A B-Spline of degree \(p\) with control points \(P^i\in\mathbb{R}^{N_{phys}}\) and a one-dimensional parameter space (\(N_{param}=1\)) corresponds to a line embedded into the physical space:
\[C(u) = \sum_{i=1}^{l} N^{i;p}(u) P^i\]2. A B-Spline of degrees \(p,q\) with control points \(P^{i,j} \in \mathbb{R}^{N_{phys}}\) and a two-dimensional parameter space (\(N_{param}=2\)) corresponds to a surface, embedded into the physical space:
\[S(u,v) = \sum_{i=1}^{l} \sum_{j=1}^{m} N^{i;p}(u) N^{j;q}(v) P^{i,j}\]Due to the tensor-product nature of the B-Spline basis functions, this is often rewritten in terms of multi-variate basis functions
\[\tilde{N}_{i,j;p,q}(u,v) := N^{i;p}(u) N^{j;q}(v)\]3. A B-Spline of degrees \(p,q,r\) with control points \(P^{i,j,k} \in \mathbb{R}^{N_{phys}}\) and a three-dimensional parameter space (\(N_{param}=3\)) corresponds to a volume, embedded into the physical space:
\[V(u,v,w) = \sum_{i=1}^{l} \sum_{j=1}^{m} \sum_{k=1}^{n} N^{i;p}(u) N^{j;q}(v) N^{k;r}(w) P^{i,j,k}\]Here, we can introduce the multi-variate basis functions
\[\tilde{N}^{i,j,k;p,q,r}(u,v,w) := N^{i;p}(u) N^{j;q}(v) N^{k;r}(w)\]Higher-dimensional instances are constructed accordingly.
Usage:
bspline_volume = splinepy.BSpline( degrees=[1, 1, 1], knot_vectors=[ [0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], ], control_points=[ [0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [1.0, 1.0, 0.0], [0.0, -1.0, 1.0], [1.0, 0.0, 1.0], [-1.0, 1.0, 2.0], [2.0, 2.0, 2.0], ], )
- Parameters:
degrees ((para_dim) array-like)
knot_vectors ((para_dim) list) – list of array-like
control_points ((n, dim) array-like)
spline (Spline)
- Return type:
None
Methods
BSpline.basis
(queries[, nthreads])Returns basis function values on the supports of given queries.
BSpline.basis_and_support
(queries[, nthreads])Returns basis function values and their support ids of given queries.
BSpline.basis_derivative
(queries, orders[, ...])Returns derivative of basis functions evaluated on the supports of given queries.
BSpline.basis_derivative_and_support
(...[, ...])Returns derivative of basis functions and their support ids of given queries.
Clears core spline and saved data
BSpline.copy
([saved_data])Returns deepcopy of stored data and newly initialized self.
BSpline.derivative
(queries, orders[, nthreads])Evaluates derivatives of spline.
BSpline.elevate_degrees
(parametric_dimensions)Elevate degree.
BSpline.evaluate
(queries[, nthreads])Evaluates spline.
BSpline.export
(fname)Export spline.
Extract all knot spans as Bezier patches to perform further operations such as compositions and multiplications
BSpline.greville_abscissae
([duplicate_tolerance])Returns greville abscissae.
BSpline.insert_knots
(parametric_dimension, knots)Inserts knots.
BSpline.jacobian
(queries[, nthreads])Evaluates jacobians on spline.
Returns knot insertion matrix for a given set of knots in a specific parametric domain, if bezier flag is set, returns matrix, that creates C^(-1) spline spaces.
BSpline.mapper
(reference)Retrieve a mapper that can be used to get physical derivatives such as a gradient or hessian in physical space
Sets all knot vectors into a range of [0,1], if applicable
BSpline.proximities
(queries[, ...])Given physical coordinate, finds a parametric coordinate that maps to the nearest physical coordinate.
BSpline.reduce_degrees
(parametric_dimensions)Tries to reduce degree.
BSpline.remove_knots
(parametric_dimension, knots)Tries to removes knots.
BSpline.sample
(resolutions[, nthreads])Uniformly sample along each parametric dimensions from spline.
BSpline.show
(**kwargs)Equivalent to
BSpline.showable
(**kwargs)Equivalent to
BSpline.support
(queries[, nthreads])Returns basis support ids of given queries.
BSpline.todict
([tolist])Return current spline as dict.
BSpline.uniform_refine
([para_dims, n_knots])Uniformly refines all knot-spans in given direction(s) by given degree(s).
Attributes
Returns NURBS version of current BSpline by defining all the weights as 1.