KSeExpr 4.0.4.0
KSeExpr::Curve< T > Class Template Reference

Interpolation curve class for double->double and double->Vec3D. More...

#include <Curve.h>

Classes

struct  CV

Public Types

enum  InterpType {
  kNone = 0 , kLinear , kSmooth , kSpline ,
  kMonotoneSpline
}
 Supported interpolation types. More...

Public Member Functions

 Curve ()
void addPoint (double position, const T &val, InterpType type)
 Adds a point to the curve.
void preparePoints ()
 Prepares points for evaluation (sorts and computes boundaries, clamps extrema)
getValue (double param) const
 Evaluates curve and returns full value.
double getChannelValue (double param, int channel) const
CV getLowerBoundCV (double param) const

Static Public Member Functions

static bool interpTypeValid (InterpType interp)
 Returns whether the given interpolation type is supported.
static bool cvLessThan (const CV &cv1, const CV &cv2)
 CV Parameter ordering (cv1._pos < cv2._pos)

Private Member Functions

void clampCurveSegment (const T &delta, T &d1, T &d2)
 Performs hermite derivative clamping in canonical space.
double comp (const double &val, const int)
double comp (const Vec3d &val, const int i)
void clampCurveSegment (const double &delta, double &d1, double &d2)
void clampCurveSegment (const Vec3d &delta, Vec3d &d1, Vec3d &d2)

Static Private Member Functions

static double comp (const T &val, int i)
 Returns a component of the given value.

Private Attributes

int cacheCV
std::vector< CV_cvData
bool prepared

Detailed Description

template<class T>
class KSeExpr::Curve< T >

Interpolation curve class for double->double and double->Vec3D.

Interpolation curve class for mapping from double -> double or double -> Vec3D Subject to some interpolation points.

Each segment is interpolated according to the interpolation type specified on the left control point. Interpolation types supported are members of InterpType below.

Valid instantiation types for this are double, or Vec3D

Definition at line 26 of file Curve.h.

Member Enumeration Documentation

◆ InterpType

template<class T>
enum KSeExpr::Curve::InterpType

Supported interpolation types.

Enumerator
kNone 
kLinear 
kSmooth 
kSpline 
kMonotoneSpline 

Definition at line 32 of file Curve.h.

Constructor & Destructor Documentation

◆ Curve()

template<class T>
KSeExpr::Curve< T >::Curve ( )

Definition at line 32 of file Curve.cpp.

References _cvData, cacheCV, kNone, and prepared.

Member Function Documentation

◆ addPoint()

template<class T>
void KSeExpr::Curve< T >::addPoint ( double position,
const T & val,
InterpType type )

Adds a point to the curve.

Definition at line 40 of file Curve.cpp.

References _cvData, and prepared.

◆ clampCurveSegment() [1/3]

void KSeExpr::Curve< double >::clampCurveSegment ( const double & delta,
double & d1,
double & d2 )
inlineprivate

Definition at line 203 of file Curve.cpp.

◆ clampCurveSegment() [2/3]

template<class T>
void KSeExpr::Curve< T >::clampCurveSegment ( const T & delta,
T & d1,
T & d2 )
private

Performs hermite derivative clamping in canonical space.

Referenced by preparePoints().

◆ clampCurveSegment() [3/3]

void KSeExpr::Curve< Vec3d >::clampCurveSegment ( const Vec3d & delta,
Vec3d & d1,
Vec3d & d2 )
private

Definition at line 213 of file Curve.cpp.

◆ comp() [1/3]

double KSeExpr::Curve< double >::comp ( const double & val,
const int  )
private

Definition at line 16 of file Curve.cpp.

◆ comp() [2/3]

template<class T>
double KSeExpr::Curve< T >::comp ( const T & val,
int i )
staticprivate

Returns a component of the given value.

Referenced by getChannelValue().

◆ comp() [3/3]

double KSeExpr::Curve< Vec3d >::comp ( const Vec3d & val,
const int i )
private

Definition at line 21 of file Curve.cpp.

◆ cvLessThan()

template<class T>
bool KSeExpr::Curve< T >::cvLessThan ( const CV & cv1,
const CV & cv2 )
static

CV Parameter ordering (cv1._pos < cv2._pos)

Definition at line 26 of file Curve.cpp.

References KSeExpr::Curve< T >::CV::_pos.

Referenced by getChannelValue(), getLowerBoundCV(), getValue(), and preparePoints().

◆ getChannelValue()

template<class T>
double KSeExpr::Curve< T >::getChannelValue ( double param,
int channel ) const

Evaluates curve for a sub-component of the interpolation values must call preparePoints() before this is ok to call

Definition at line 139 of file Curve.cpp.

References _cvData, comp(), cvLessThan(), kLinear, kMonotoneSpline, kNone, kSmooth, kSpline, and prepared.

◆ getLowerBoundCV()

template<class T>
Curve< T >::CV KSeExpr::Curve< T >::getLowerBoundCV ( double param) const

Returns the control point that is less than the parameter, unless there is no point, in which case it returns the right point or nothing

Definition at line 186 of file Curve.cpp.

References _cvData, cvLessThan(), kLinear, and prepared.

◆ getValue()

template<class T>
T KSeExpr::Curve< T >::getValue ( double param) const

Evaluates curve and returns full value.

Definition at line 94 of file Curve.cpp.

References _cvData, cvLessThan(), kLinear, kMonotoneSpline, kNone, kSmooth, kSpline, and prepared.

◆ interpTypeValid()

template<class T>
bool KSeExpr::Curve< T >::interpTypeValid ( InterpType interp)
static

Returns whether the given interpolation type is supported.

Definition at line 198 of file Curve.cpp.

References kLinear, kMonotoneSpline, kNone, kSmooth, and kSpline.

Referenced by KSeExpr::CCurveFuncX::evalConstant(), KSeExpr::CurveFuncX::evalConstant(), KSeExpr::CCurveFuncX::prep(), and KSeExpr::CurveFuncX::prep().

◆ preparePoints()

template<class T>
void KSeExpr::Curve< T >::preparePoints ( )

Prepares points for evaluation (sorts and computes boundaries, clamps extrema)

Definition at line 46 of file Curve.cpp.

References _cvData, KSeExpr::Curve< T >::CV::_deriv, KSeExpr::Curve< T >::CV::_interp, KSeExpr::Curve< T >::CV::_pos, KSeExpr::Curve< T >::CV::_val, cacheCV, clampCurveSegment(), cvLessThan(), kMonotoneSpline, kNone, and prepared.

Member Data Documentation

◆ _cvData

template<class T>
std::vector<CV> KSeExpr::Curve< T >::_cvData
private

Definition at line 47 of file Curve.h.

Referenced by addPoint(), Curve(), getChannelValue(), getLowerBoundCV(), getValue(), and preparePoints().

◆ cacheCV

template<class T>
int KSeExpr::Curve< T >::cacheCV
mutableprivate

Definition at line 28 of file Curve.h.

Referenced by Curve(), and preparePoints().

◆ prepared

template<class T>
bool KSeExpr::Curve< T >::prepared
private

Definition at line 48 of file Curve.h.

Referenced by addPoint(), Curve(), getChannelValue(), getLowerBoundCV(), getValue(), and preparePoints().


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