chrono::ChFunction_BSpline Class Reference

Description

B-Spline motion function.

#include <ChFunction_BSpline.h>

Inheritance diagram for chrono::ChFunction_BSpline:
Collaboration diagram for chrono::ChFunction_BSpline:

Public Member Functions

 ChFunction_BSpline (int p, const ChVectorDynamic<> &cpoints, ChVectorDynamic<> *knots=0)
 Generic univariate B-Spline of order p, approximating given control points. More...
 
 ChFunction_BSpline (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...
 
 ChFunction_BSpline (const ChFunction_BSpline &other)
 
virtual ChFunction_BSplineClone () const override
 "Virtual" copy constructor (covariant return type).
 
virtual void Setup_Data (int p, ChVectorDynamic<> cpoints, ChVectorDynamic<> *knots)
 Setup internal data of B-Spline.
 
virtual FunctionType Get_Type () const override
 Get type of ChFunction.
 
int Get_Order () const
 Get B-Spline order.
 
ChVectorDynamic Get_Control_Points () const
 Get B-Spline control points.
 
ChVectorDynamic Get_Knots () const
 Get B-Spline knots.
 
ChVectorDynamic Get_Control_Points_Abscissae () const
 Get B-Spline averaged control points abscissae (Greville abscissae) as in [De Boor, chapt. More...
 
std::shared_ptr< geometry::ChBasisToolsBsplineGet_Basis_Tool ()
 Get B-Spline internal tool to evaluate basis functions.
 
virtual double Get_y (double x) const override
 B-Spline: y(x) = = SUM_i Ni,p(x) b_i.
 
virtual double Get_y_dx (double x) const override
 B-Spline 1st derivative: y(x)' = = SUM_i Ni,p(x)' b_i.
 
virtual double Get_y_dxdx (double x) const override
 B-Spline 2nd derivative: y(x)'' = = SUM_i Ni,p(x)'' b_i.
 
virtual double Get_y_dxdxdx (double x) const override
 B-Spline 3rd derivative: y(x)''' = = SUM_i Ni,p(x)''' b_i.
 
virtual void Recompute_Constrained (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 &marchive) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIn (ChArchiveIn &marchive) override
 Method to allow de-serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChFunction
 ChFunction (const ChFunction &other)
 
virtual double Get_weight (double x) const
 Return the weight of the function (useful for applications where you need to mix different weighted ChFunctions)
 
virtual void Estimate_x_range (double &xmin, double &xmax) const
 Return an estimate of the range of the function argument. More...
 
virtual void Estimate_y_range (double xmin, double xmax, double &ymin, double &ymax, int derivate) const
 Return an estimate of the range of the function value. More...
 
virtual double Get_y_dN (double x, int derivate) const
 Return the function derivative of specified order at the given point. More...
 
virtual void Update (double x)
 Update could be implemented by children classes, ex. to launch callbacks.
 
virtual double Compute_max (double xmin, double xmax, double sampling_step, int derivate) const
 Compute the maximum of y(x) in a range xmin-xmax, using a sampling method.
 
virtual double Compute_min (double xmin, double xmax, double sampling_step, int derivate) const
 Compute the minimum of y(x) in a range xmin-xmax, using a sampling method.
 
virtual double Compute_mean (double xmin, double xmax, double sampling_step, int derivate) const
 Compute the mean value of y(x) in a range xmin-xmax, using a sampling method.
 
virtual double Compute_sqrmean (double xmin, double xmax, double sampling_step, int derivate) const
 Compute the square mean val. of y(x) in a range xmin-xmax, using sampling.
 
virtual double Compute_int (double xmin, double xmax, double sampling_step, int derivate) const
 Compute the integral of y(x) in a range xmin-xmax, using a sampling method.
 
virtual double Get_Ca_pos () const
 Computes the positive acceleration coefficient (inherited classes should customize this).
 
virtual double Get_Ca_neg () const
 Compute the positive acceleration coefficient (inherited classes should customize this).
 
virtual double Get_Cv () const
 Compute the speed coefficient (inherited classes must customize this).
 
virtual int HandleNumber () const
 Return the number of handles of the function.
 
virtual bool HandleAccess (int handle_id, double mx, double my, bool set_mode)
 Get the x and y position of handle, given identifier. More...
 
virtual int FilePostscriptPlot (ChFile_ps *m_file, int plotY, int plotDY, int plotDDY)
 Plot function in graph space of the ChFile_ps postscript file where zoom factor, centering, color, thickness etc. More...
 
virtual int FileAsciiPairsSave (ChStreamOutAscii &m_file, double xmin=0, double xmax=1, int msamples=200)
 Save function as X-Y pairs separated by space, with CR at each pair, into an ASCII file. More...
 
virtual void EvaluateIntervaldN (ChMatrixDynamic<> &data, double xmin, double xmax, double step, int der=0)
 Sample function on entire interval, up to Nth derivative (der = 0: y, 1: y_dx, 2: y_dxdx, 3: y_dxdxdx). More...
 

Additional Inherited Members

- Public Types inherited from chrono::ChFunction
enum  FunctionType {
  FUNCT_CUSTOM, FUNCT_CONST, FUNCT_CONSTACC, FUNCT_DERIVE,
  FUNCT_FILLET3, FUNCT_INTEGRATE, FUNCT_MATLAB, FUNCT_MIRROR,
  FUNCT_MOCAP, FUNCT_NOISE, FUNCT_OPERATION, FUNCT_OSCILLOSCOPE,
  FUNCT_POLY, FUNCT_POLY345, FUNCT_RAMP, FUNCT_RECORDER,
  FUNCT_REPEAT, FUNCT_SEQUENCE, FUNCT_SIGMA, FUNCT_SINE,
  FUNCT_LAMBDA, FUNCT_CYCLOIDAL, FUNCT_BSPLINE, FUNCT_DOUBLES
}
 Enumeration of function types.
 

Constructor & Destructor Documentation

◆ ChFunction_BSpline() [1/2]

chrono::ChFunction_BSpline::ChFunction_BSpline ( 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

◆ ChFunction_BSpline() [2/2]

chrono::ChFunction_BSpline::ChFunction_BSpline ( 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 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

◆ Get_Control_Points_Abscissae()

ChVectorDynamic chrono::ChFunction_BSpline::Get_Control_Points_Abscissae ( ) 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]

◆ Recompute_Constrained()

void chrono::ChFunction_BSpline::Recompute_Constrained ( 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

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