SeExpr
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SeExpr2::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. More...
 
void preparePoints ()
 Prepares points for evaluation (sorts and computes boundaries, clamps extrema) More...
 
getValue (const double param) const
 Evaluates curve and returns full value. More...
 
double getChannelValue (const double param, int channel) const
 
CV getLowerBoundCV (const double param) const
 

Static Public Member Functions

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

Private Member Functions

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

Static Private Member Functions

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

Private Attributes

int cacheCV
 
std::vector< CV_cvData
 
bool prepared
 

Detailed Description

template<class T>
class SeExpr2::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 38 of file Curve.h.

Member Enumeration Documentation

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

Supported interpolation types.

Enumerator
kNone 
kLinear 
kSmooth 
kSpline 
kMonotoneSpline 

Definition at line 43 of file Curve.h.

Constructor & Destructor Documentation

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

Definition at line 43 of file Curve.cpp.

References SeExpr2::Curve< T >::_cvData, and SeExpr2::Curve< T >::kNone.

Member Function Documentation

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

Adds a point to the curve.

Definition at line 50 of file Curve.cpp.

Referenced by CCurveScene::rebuildCurve(), and CurveScene::rebuildCurve().

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

Performs hermite derivative clamping in canonical space.

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

Definition at line 216 of file Curve.cpp.

References SeExpr2::clamp().

template<>
void SeExpr2::Curve< Vec3d >::clampCurveSegment ( const Vec3d delta,
Vec3d d1,
Vec3d d2 
)
private

Definition at line 226 of file Curve.cpp.

References SeExpr2::clamp().

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

Definition at line 28 of file Curve.cpp.

template<>
double SeExpr2::Curve< Vec3d >::comp ( const Vec3d val,
const int  i 
)
private

Definition at line 33 of file Curve.cpp.

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

Returns a component of the given value.

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

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

Definition at line 38 of file Curve.cpp.

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

template<class T >
double SeExpr2::Curve< T >::getChannelValue ( const 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 150 of file Curve.cpp.

References index(), SeExpr2::max(), SeExpr2::min(), x, and y.

template<class T >
Curve< T >::CV SeExpr2::Curve< T >::getLowerBoundCV ( const 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 199 of file Curve.cpp.

References index(), SeExpr2::max(), and SeExpr2::min().

Referenced by CCurveScene::mousePressEvent(), and CurveScene::mousePressEvent().

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

Evaluates curve and returns full value.

Definition at line 104 of file Curve.cpp.

References index(), SeExpr2::max(), SeExpr2::min(), x, and y.

Referenced by CurveScene::drawPoly(), CCurveScene::getCPixmap(), and CCurveScene::mousePressEvent().

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

Returns whether the given interpolation type is supported.

Definition at line 211 of file Curve.cpp.

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

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

Definition at line 56 of file Curve.cpp.

References SeExpr2::Curve< T >::CV::_deriv, SeExpr2::Curve< T >::CV::_interp, SeExpr2::Curve< T >::CV::_pos, and SeExpr2::Curve< T >::CV::_val.

Referenced by CCurveScene::rebuildCurve(), and CurveScene::rebuildCurve().

Member Data Documentation

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

Definition at line 59 of file Curve.h.

Referenced by SeExpr2::Curve< T >::Curve().

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

Definition at line 39 of file Curve.h.

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

Definition at line 60 of file Curve.h.


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