Spline
– Spline Objects¶
-
class
trep.
Spline
(points)¶ Parameters: points – A list of points defining the spline. See details.
The Spline
class implements 1D spline interpolation between a set of
points. Spline
provides methods to evaluate points on the
spline curve as well as its first and second derivatives. It can be
used by new types of forces, potentials, and constraints to implement
calculations.
The spline is defined by the list points. Each entry in points is
a list of 2-4 numbers. The first two numbers are the x and y
values of the points. The remaining two numbers, if provided and not
None
, are the first and second derivatives of the curve at
that point. Any derivatives not provided are determined by the
resulting interpolation.
For N points, The spline will comprise N-1 polynomials of order
3-5, depending on how many derivatives were specified. Spline
will choose the lowest order polynomials possible while still being
able to satisfy the specified values. Specifying derivatives directly
is much more effective than placing several points infinitesimally
close to force the curve into a particular shape.
Spline Objects¶
-
Spline.
x_points
¶ Return type: numpy.ndarray
List of the x points that define this spline.
(read-only)
-
Spline.
y_points
¶ Return type: numpy.ndarray
List of the y points that define this spline.
(read-only)
-
Spline.
coefficients
¶ Return type: numpy.ndarray
The coefficients of the interpolating polynomials.
(read-only)
-
Spline.
y
(x)¶ Return type: Float
Evaluate the spline at x.
-
Spline.
dy
(x)¶ Return type: Float
Evaluate the derivative of the spline at x.
-
Spline.
ddy
(x)¶ Return type: Float
Evaluate the second derivative of the spline at x.