Spline#

class splinebox.spline_curves.Spline(M, basis_function, closed=False, control_points=None, padding_function=<function padding_function>)#

Base class for the construction of a spline.

Parameters#

Mint

Number of knots.

basis_functionsplinebox.basis_functions.BasisFunction

The basis function used to construct the spline.

closedboolean

Whether or not the spline is closed, i.e. the two ends are connected.

control_pointsnp.array

The control points of the spline. Optional, can be provided later.

padding_functioncallable

A function that accepts an array of knots as the first argument and the padding size as the second argument. It should return a padded array. If None, a padded array has to be supplied when setting the knots. The default is constant padding with the edge values (see splinebox.spline_curves.padding_function()).

Attributes

M

basis_function

The basis function of the spline.

closed

control_points

The control points of this spline, i.e. the c[k] in equation (1).

half_support

knots

The knots of this spline, i.e. the values of the spline at \(t=0,1,...,M\).

pad

Methods

arc_length([stop, start, epsabs, epsrel])

Compute the arc length of the spline between the two parameter values specified.

arc_length_to_parameter(s[, atol])

Convert the arc length s to the coresponding value in parameter space.

copy()

Returns a deep copy of this spline.

curvature(t)

Compute the curvature of the spline at position(s) t.

curvilinear_reparametrization_energy([...])

This energy can be used to enforce equal spacing of the knots.

distance(point[, return_t])

Computes the distance of point from the spline.

draw(x, y)

Computes whether a point is inside or outside a closed spline on a regular grid of points.

dtheta(t)

Helper function for calculating the winding number.

eval(t[, derivative])

eval is deprecated use splinebox.spline_curves.Spline.__call__() instead.

fit(points[, arc_length_parameterization])

Fit the provided points with the spline using least squares.

from_json(path)

Constructs a spline from a json file that was saved using splinebox.spline_curves.Spline.to_json().

is_inside(x, y)

Determines if a point with coordinates x, y is inside the spline.

mesh([radius, step_t, step_angle, ...])

Create a 3D mesh around the spline curve.

moving_frame(t[, method, initial_vector])

Compute a moving frame (local orthonormal coordinate system) along the spline.

normal(t[, frame, initial_vector])

Returns the normal vector for 1D and 2D splines.

rotate(rotation_matrix[, centred])

Rotate the spline with the provided rotation matrix.

scale(scaling_factor)

Enlarge or shrink the spline by the provided factor.

to_json(path[, version])

Saves the spline as a json file.

translate(vector)

Translates the spline by a vector.