chrono::ChFunctionBSpline Class Reference

Description

B-Spline motion function.

#include <ChFunctionBSpline.h>

Inheritance diagram for chrono::ChFunctionBSpline:
Collaboration diagram for chrono::ChFunctionBSpline:

Public Member Functions

 ChFunctionBSpline (int p, const ChVectorDynamic<> &cpoints, ChVectorDynamic<> *knots=0)
 Generic univariate B-Spline of order p, approximating given control points. More...
 
 ChFunctionBSpline (int p, const ChVectorDynamic<> &x_interp, const ChVectorDynamic<> &y_dN_interp, const ChVectorDynamic< int > &der_order, ChVectorDynamic<> *knots=0)
 Univariate B-Spline of order p, exactly interpolating given waypoints and derivatives: internally solve linear problem A * b = c to find proper constrained control points (eg. More...
 
 ChFunctionBSpline (const ChFunctionBSpline &other)
 
virtual ChFunctionBSplineClone () const override
 "Virtual" copy constructor (covariant return type).
 
virtual void Setup (int p, ChVectorDynamic<> cpoints, ChVectorDynamic<> *knots)
 Setup internal data of B-Spline.
 
virtual Type GetType () const override
 Get type of ChFunction.
 
int GetOrder () const
 Get B-Spline order.
 
ChVectorDynamic GetControlPoints () const
 Get B-Spline control points.
 
ChVectorDynamic GetControlPointsAbscissae () const
 Get B-Spline averaged control points abscissae (Greville abscissae) as in [De Boor, chapt. More...
 
ChVectorDynamic GetKnots () const
 Get B-Spline knots.
 
std::shared_ptr< ChBasisToolsBSplineGetBasisTool ()
 Get B-Spline internal tool to evaluate basis functions.
 
virtual double GetVal (double x) const override
 B-Spline: y(x) = = SUM_i Ni,p(x) b_i.
 
virtual double GetDer (double x) const override
 B-Spline 1st derivative: y(x)' = = SUM_i Ni,p(x)' b_i.
 
virtual double GetDer2 (double x) const override
 B-Spline 2nd derivative: y(x)'' = = SUM_i Ni,p(x)'' b_i.
 
virtual double GetDer3 (double x) const override
 B-Spline 3rd derivative: y(x)''' = = SUM_i Ni,p(x)''' b_i.
 
virtual void ApplyInterpolationConstraints (int p, const ChVectorDynamic<> &x_interp, const ChVectorDynamic<> &y_dN_interp, const ChVectorDynamic< int > der_order, ChVectorDynamic<> *knots=0)
 Recompute B-Spline control points to exactly interpolate given waypoints and derivatives (eg. More...
 
virtual void ArchiveOut (ChArchiveOut &archive_out) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIn (ChArchiveIn &archive_in) override
 Method to allow de-serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChFunction
 ChFunction (const ChFunction &other)
 
virtual double GetDerN (double x, int der_order) const
 Return the Nth derivative of the function (up to 3rd derivative). More...
 
virtual double GetWeight (double x) const
 Return the weight of the function. More...
 
virtual void Update (double x)
 Update the function at the provided value of its argument.
 
virtual double GetMax (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the maximum of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetMin (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the minimum of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetMean (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the mean of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetSquaredMean (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the squared mean of the function (or its der_order derivative) in the range [xmin, xmax]. More...
 
virtual double GetIntegral (double xmin, double xmax, double sampling_step, int der_order) const
 Estimate the integral of the function (or its der_order derivative) over the range [xmin, xmax]. More...
 
virtual double GetPositiveAccelerationCoeff () const
 Compute the positive acceleration coefficient. More...
 
virtual double GetNegativeAccelerationCoeff () const
 Compute the negative acceleration coefficient. More...
 
virtual double GetVelocityCoefficient () const
 Compute the velocity coefficient. More...
 
virtual void OutputToASCIIFile (std::ostream &file, double xmin, double xmax, int samples, char delimiter)
 Store X-Y pairs to an ASCII File. More...
 
virtual ChMatrixDynamic SampleUpToDerN (double xmin, double xmax, double step, int derN=0)
 Sample function on given interval [xmin, xmax], up to derN derivative (0 being the function ouput itself). More...
 
double operator() (double arg) const
 Alias operator of the GetVal function.
 

Additional Inherited Members

- Public Types inherited from chrono::ChFunction
enum  Type {
  BSPLINE, CONSTANT, CONSTACC, CONSTJERK,
  CUSTOM, CYCLOIDAL, DERIVATIVE, FILLET3,
  INTEGRAL, INTERP, LAMBDA, MIRROR,
  OPERATOR, POLY, POLY23, POLY345,
  RAMP, REPEAT, SEQUENCE, SINE,
  SINE_STEP
}
 Enumeration of function types.
 

Constructor & Destructor Documentation

◆ ChFunctionBSpline() [1/2]

chrono::ChFunctionBSpline::ChFunctionBSpline ( int  p,
const ChVectorDynamic<> &  cpoints,
ChVectorDynamic<> *  knots = 0 
)

Generic univariate B-Spline of order p, approximating given control points.

If knot vector is not provided, initialize it as equally spaced and clamped at both ends.

Parameters
porder
cpointscontrol points
knotsknot vector

◆ ChFunctionBSpline() [2/2]

chrono::ChFunctionBSpline::ChFunctionBSpline ( int  p,
const ChVectorDynamic<> &  x_interp,
const ChVectorDynamic<> &  y_dN_interp,
const ChVectorDynamic< int > &  der_order,
ChVectorDynamic<> *  knots = 0 
)

Univariate B-Spline of order p, exactly interpolating given waypoints and derivatives: internally solve linear problem A * b = c to find proper constrained control points (eg.

useful to pass through given points with assigned velocities, at specific times). If knot vector is not provided, initialize it as equally spaced and clamped at both ends.

Parameters
porder
x_interpparameters (eg. times) at which to perform interpolation
y_dN_interpoutput value to interpolate, Nth derivative: y(x)^(Nth)
der_orderderivative order of given interpolation output (0: pos, 1: vel, 2: acc, ...)
knotsknot vector

Member Function Documentation

◆ ApplyInterpolationConstraints()

void chrono::ChFunctionBSpline::ApplyInterpolationConstraints ( int  p,
const ChVectorDynamic<> &  x_interp,
const ChVectorDynamic<> &  y_dN_interp,
const ChVectorDynamic< int >  der_order,
ChVectorDynamic<> *  knots = 0 
)
virtual

Recompute B-Spline control points to exactly interpolate given waypoints and derivatives (eg.

satisfy position, velocity, acceleration constraints).

Parameters
porder
x_interpparameters (eg. times) at which perform interpolation
y_dN_interpoutput value to interpolate, Nth derivative: y(x)^(Nth)
der_orderderivative order of given interpolation output (0: pos, 1: vel, 2: acc, ...)
knotsknot vector

◆ GetControlPointsAbscissae()

ChVectorDynamic chrono::ChFunctionBSpline::GetControlPointsAbscissae ( ) const

Get B-Spline averaged control points abscissae (Greville abscissae) as in [De Boor, chapt.

XI] averaging formula. Useful, in univariate B-Spline functions, to get csi(x) abscissae associated to control points y(x), ie. b_i = [cpointx_i, cpointy_i] = [csi(x)_i, y(x)_i]


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/functions/ChFunctionBSpline.h
  • /builds/uwsbel/chrono/src/chrono/functions/ChFunctionBSpline.cpp