Interpolation curve class for double->double and double->SeVec3D. More...
#include <SeCurve.h>
Classes | |
struct | CV |
Public Types | |
enum | InterpType { kNone = 0, kLinear, kSmooth, kSpline, kMonotoneSpline } |
Supported interpolation types. More... | |
Public Member Functions | |
SeCurve () | |
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). | |
T | getValue (const double param) const |
Evaluates curve and returns full value. | |
double | getChannelValue (const double param, int channel) const |
CV | getLowerBoundCV (const double param) const |
template<> | |
double | comp (const double &val, const int) |
template<> | |
double | comp (const SeVec3d &val, const int i) |
template<> | |
void | clampCurveSegment (const double &delta, double &d1, double &d2) |
template<> | |
void | clampCurveSegment (const SeVec3d &delta, SeVec3d &d1, SeVec3d &d2) |
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. | |
Static Private Member Functions | |
static double | comp (const T &val, const int i) |
Returns a component of the given value. | |
Private Attributes | |
int | cacheCV |
std::vector< CV > | _cvData |
bool | prepared |
Interpolation curve class for double->double and double->SeVec3D.
Interpolation curve class for mapping from double -> double or double -> SeVec3D 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 SeVec3D
Definition at line 32 of file SeCurve.h.
enum SeExpr::SeCurve::InterpType |
SeExpr::SeCurve< T >::SeCurve | ( | ) | [inline] |
Definition at line 33 of file SeCurve.cpp.
References SeExpr::SeCurve< T >::_cvData, and SeExpr::SeCurve< T >::kNone.
void SeExpr::SeCurve< T >::addPoint | ( | double | position, | |
const T & | val, | |||
InterpType | type | |||
) | [inline] |
Adds a point to the curve.
Definition at line 41 of file SeCurve.cpp.
References SeExpr::SeCurve< T >::_cvData, and SeExpr::SeCurve< T >::prepared.
Referenced by CurveScene::rebuildCurve(), and CCurveScene::rebuildCurve().
void SeExpr::SeCurve< SeVec3d >::clampCurveSegment | ( | const SeVec3d & | delta, | |
SeVec3d & | d1, | |||
SeVec3d & | d2 | |||
) | [inline] |
Definition at line 237 of file SeCurve.cpp.
References SeExpr::clamp().
void SeExpr::SeCurve< double >::clampCurveSegment | ( | const double & | delta, | |
double & | d1, | |||
double & | d2 | |||
) | [inline] |
Definition at line 227 of file SeCurve.cpp.
References SeExpr::clamp().
void SeExpr::SeCurve< T >::clampCurveSegment | ( | const T & | delta, | |
T & | d1, | |||
T & | d2 | |||
) | [private] |
Performs hermite derivative clamping in canonical space.
Referenced by SeExpr::SeCurve< T >::preparePoints().
double SeExpr::SeCurve< SeVec3d >::comp | ( | const SeVec3d & | val, | |
const int | i | |||
) | [inline] |
Definition at line 23 of file SeCurve.cpp.
double SeExpr::SeCurve< double >::comp | ( | const double & | val, | |
const | int | |||
) | [inline] |
Definition at line 20 of file SeCurve.cpp.
static double SeExpr::SeCurve< T >::comp | ( | const T & | val, | |
const int | i | |||
) | [static, private] |
Returns a component of the given value.
Referenced by SeExpr::SeCurve< T >::getChannelValue().
bool SeExpr::SeCurve< T >::cvLessThan | ( | const CV & | cv1, | |
const CV & | cv2 | |||
) | [inline, static] |
CV Parameter ordering (cv1._pos < cv2._pos).
Definition at line 27 of file SeCurve.cpp.
References SeExpr::SeCurve< T >::CV::_pos.
Referenced by SeExpr::SeCurve< T >::getChannelValue(), SeExpr::SeCurve< T >::getLowerBoundCV(), SeExpr::SeCurve< T >::getValue(), and SeExpr::SeCurve< T >::preparePoints().
double SeExpr::SeCurve< T >::getChannelValue | ( | const double | param, | |
int | channel | |||
) | const [inline] |
Evaluates curve for a sub-component of the interpolation values must call preparePoints() before this is ok to call
Definition at line 153 of file SeCurve.cpp.
References SeExpr::SeCurve< T >::_cvData, SeExpr::SeCurve< T >::comp(), SeExpr::SeCurve< T >::cvLessThan(), index(), SeExpr::SeCurve< T >::kLinear, SeExpr::SeCurve< T >::kMonotoneSpline, SeExpr::SeCurve< T >::kNone, SeExpr::SeCurve< T >::kSmooth, SeExpr::SeCurve< T >::kSpline, SeExpr::max(), SeExpr::min(), SeExpr::SeCurve< T >::prepared, x, and y.
SeCurve< T >::CV SeExpr::SeCurve< T >::getLowerBoundCV | ( | const double | param | ) | const [inline] |
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 207 of file SeCurve.cpp.
References SeExpr::SeCurve< T >::_cvData, SeExpr::SeCurve< T >::cvLessThan(), index(), SeExpr::SeCurve< T >::kLinear, SeExpr::max(), SeExpr::min(), and SeExpr::SeCurve< T >::prepared.
Referenced by CurveScene::mousePressEvent(), and CCurveScene::mousePressEvent().
T SeExpr::SeCurve< T >::getValue | ( | const double | param | ) | const [inline] |
Evaluates curve and returns full value.
Definition at line 99 of file SeCurve.cpp.
References SeExpr::SeCurve< T >::_cvData, SeExpr::SeCurve< T >::cvLessThan(), index(), SeExpr::SeCurve< T >::kLinear, SeExpr::SeCurve< T >::kMonotoneSpline, SeExpr::SeCurve< T >::kNone, SeExpr::SeCurve< T >::kSmooth, SeExpr::SeCurve< T >::kSpline, SeExpr::max(), SeExpr::min(), SeExpr::SeCurve< T >::prepared, x, and y.
Referenced by CurveScene::drawPoly(), and CCurveScene::getCPixmap().
bool SeExpr::SeCurve< T >::interpTypeValid | ( | InterpType | interp | ) | [inline, static] |
Returns whether the given interpolation type is supported.
Definition at line 220 of file SeCurve.cpp.
References SeExpr::SeCurve< T >::kLinear, SeExpr::SeCurve< T >::kMonotoneSpline, SeExpr::SeCurve< T >::kNone, SeExpr::SeCurve< T >::kSmooth, and SeExpr::SeCurve< T >::kSpline.
void SeExpr::SeCurve< T >::preparePoints | ( | ) | [inline] |
Prepares points for evaluation (sorts and computes boundaries, clamps extrema).
Definition at line 48 of file SeCurve.cpp.
References SeExpr::SeCurve< T >::_cvData, SeExpr::SeCurve< T >::CV::_deriv, SeExpr::SeCurve< T >::CV::_interp, SeExpr::SeCurve< T >::CV::_pos, SeExpr::SeCurve< T >::CV::_val, SeExpr::SeCurve< T >::cacheCV, SeExpr::SeCurve< T >::clampCurveSegment(), SeExpr::SeCurve< T >::cvLessThan(), SeExpr::SeCurve< T >::kMonotoneSpline, SeExpr::SeCurve< T >::kNone, and SeExpr::SeCurve< T >::prepared.
Referenced by CurveScene::rebuildCurve(), and CCurveScene::rebuildCurve().
std::vector<CV> SeExpr::SeCurve< T >::_cvData [private] |
Definition at line 48 of file SeCurve.h.
Referenced by SeExpr::SeCurve< T >::addPoint(), SeExpr::SeCurve< T >::getChannelValue(), SeExpr::SeCurve< T >::getLowerBoundCV(), SeExpr::SeCurve< T >::getValue(), SeExpr::SeCurve< T >::preparePoints(), and SeExpr::SeCurve< T >::SeCurve().
int SeExpr::SeCurve< T >::cacheCV [mutable, private] |
Definition at line 34 of file SeCurve.h.
Referenced by SeExpr::SeCurve< T >::preparePoints().
bool SeExpr::SeCurve< T >::prepared [private] |
Definition at line 49 of file SeCurve.h.
Referenced by SeExpr::SeCurve< T >::addPoint(), SeExpr::SeCurve< T >::getChannelValue(), SeExpr::SeCurve< T >::getLowerBoundCV(), SeExpr::SeCurve< T >::getValue(), and SeExpr::SeCurve< T >::preparePoints().