geomc 1.0
A c++ linear algebra template library
Loading...
Searching...
No Matches
PolynomialSpline< T, N > Class Template Reference

A cubic polynomial spline. More...

#include <geomc/shape/CubicSpline.h>

Inheritance diagram for PolynomialSpline< T, N >:
Dimensional< T, N >

Public Types

using elem_t
 The coordinate type of this object.
 
using point_t
 The type of a point in this object's space.
 

Public Member Functions

constexpr PolynomialSpline (const VecType< T, N > pts[4])
 Construct a cubic polynomial spline from an array of coefficients.
 
constexpr PolynomialSpline (VecType< T, N > k0, VecType< T, N > k1, VecType< T, N > k2, VecType< T, N > k3)
 Construct a cubic polynomial spline from coefficients.
 
constexpr VecType< T, Nacceleration (T s) const
 Compute the second derivative (acceleration) of the spline at a given parameter value.
 
Rect< T, Nbounds () const
 Compute the bounding box of the spline.
 
constexpr VecType< T, N > * control_points ()
 Get an array of the four control points.
 
constexpr const VecType< T, N > * control_points () const
 Get a const array of the four control points.
 
template<CubicSplineObject< T, N > Spline>
constexpr operator Spline () const
 Convert to another type of cubic spline.
 
constexpr VecType< T, Noperator() (T s) const
 Evaluate the spline at a given parameter value.
 
constexpr VecType< T, Nvelocity (T s) const
 Compute the derivative (velocity) of the spline at a given parameter value.
 

Static Public Member Functions

static constexpr SimpleMatrix< T, 4, 4 > basis ()
 The basis matrix for a cubic polynomial spline, which is the identity matrix.
 
static constexpr SimpleMatrix< T, 4, 4 > inverse_basis ()
 The inverse basis matrix for a cubic polynomial spline, which is the identity matrix.
 

Public Attributes

VecType< T, Nk0
 Constant coefficient.
 
VecType< T, Nk1
 Coefficient for s.
 
VecType< T, Nk2
 Coefficient for s2.
 
VecType< T, Nk3
 Coefficient for s3.
 

Static Public Attributes

static constexpr SimpleMatrix< T, 4, 4 > CoefficientsToControl
 
static constexpr SimpleMatrix< T, 4, 4 > ControlToCoefficients
 
static constexpr index_t N
 The dimension of this object.
 

Detailed Description

template<typename T, index_t N>
class geom::PolynomialSpline< T, N >

A cubic polynomial spline.

PolynomialSplines store the coefficients of the polynomial directly. They are more efficient to evaluate than other cubic splines, but are not as convenient to work with.

If evaluating a spline many times, it is more efficient to convert it to a PolynomialSpline first.

Member Typedef Documentation

◆ point_t

using point_t
inherited

The type of a point in this object's space.

An N-vector of T if N > 1, otherwise a T.

Member Data Documentation

◆ CoefficientsToControl

template<typename T, index_t N>
SimpleMatrix<T,4,4> CoefficientsToControl
staticconstexpr
Initial value:
= {
{ 1, 0, 0, 0},
{ 0, 1, 0, 0},
{ 0, 0, 1, 0},
{ 0, 0, 0, 1},
}

◆ ControlToCoefficients

template<typename T, index_t N>
SimpleMatrix<T,4,4> ControlToCoefficients
staticconstexpr
Initial value:
= {
{ 1, 0, 0, 0},
{ 0, 1, 0, 0},
{ 0, 0, 1, 0},
{ 0, 0, 0, 1},
}

The documentation for this class was generated from the following file: