32 #ifndef LinearInterpolator_INCLUDE_ONCE 33 #define LinearInterpolator_INCLUDE_ONCE 51 VL_DEBUG_SET_OBJECT_NAME()
59 t =
clamp(t,0.0f,1.0f);
64 int p0 = int((
mPath.size()-1)*t);
66 if (p1 > (
int)
mPath.size()-1)
67 p1 = (
int)
mPath.size()-1;
68 float tt = (
mPath.size()-1)*t - p0;
77 const std::vector<T>&
path()
const {
return mPath; }
103 LinearInterpolatorFVec4_T*
interpolator() {
return mInterpolator.get(); }
104 const LinearInterpolatorFVec4_T*
interpolator()
const {
return mInterpolator.get(); }
105 void setInterpolator(LinearInterpolatorFVec4_T* interpolator) { mInterpolator = interpolator; }
117 LinearInterpolatorFVec3_T*
interpolator() {
return mInterpolator.get(); }
118 const LinearInterpolatorFVec3_T*
interpolator()
const {
return mInterpolator.get(); }
119 void setInterpolator(LinearInterpolatorFVec3_T* interpolator) { mInterpolator = interpolator; }
131 LinearInterpolatorFVec2_T*
interpolator() {
return mInterpolator.get(); }
132 const LinearInterpolatorFVec2_T*
interpolator()
const {
return mInterpolator.get(); }
133 void setInterpolator(LinearInterpolatorFVec2_T* interpolator) { mInterpolator = interpolator; }
144 float computePoint(
float t)
const {
return interpolator()->computePoint(t); }
145 LinearInterpolatorFloat_T*
interpolator() {
return mInterpolator.get(); }
146 const LinearInterpolatorFloat_T*
interpolator()
const {
return mInterpolator.get(); }
147 void setInterpolator(LinearInterpolatorFloat_T* interpolator) { mInterpolator = interpolator; }
159 LinearInterpolatorDVec4_T*
interpolator() {
return mInterpolator.get(); }
160 const LinearInterpolatorDVec4_T*
interpolator()
const {
return mInterpolator.get(); }
161 void setInterpolator(LinearInterpolatorDVec4_T* interpolator) { mInterpolator = interpolator; }
173 LinearInterpolatorDVec3_T*
interpolator() {
return mInterpolator.get(); }
174 const LinearInterpolatorDVec3_T*
interpolator()
const {
return mInterpolator.get(); }
175 void setInterpolator(LinearInterpolatorDVec3_T* interpolator) { mInterpolator = interpolator; }
187 LinearInterpolatorDVec2_T*
interpolator() {
return mInterpolator.get(); }
188 const LinearInterpolatorDVec2_T*
interpolator()
const {
return mInterpolator.get(); }
189 void setInterpolator(LinearInterpolatorDVec2_T* interpolator) { mInterpolator = interpolator; }
200 double computePoint(
float t)
const {
return interpolator()->computePoint(t); }
201 LinearInterpolatorDouble_T*
interpolator() {
return mInterpolator.get(); }
202 const LinearInterpolatorDouble_T*
interpolator()
const {
return mInterpolator.get(); }
203 void setInterpolator(LinearInterpolatorDouble_T* interpolator) { mInterpolator = interpolator; }
LinearInterpolatorDVec3(const std::vector< dvec3 > &path)
LinearInterpolatorFVec4_T * interpolator()
Interpolates dvec3 values using a LinearInterpolator.
Interpolates fvec2 values using a LinearInterpolator.
ref< LinearInterpolatorFVec4_T > mInterpolator
Abstract class that interpolates vl::fvec2 values.
float clamp(float x, float minval, float maxval)
ref< LinearInterpolatorDVec2_T > mInterpolator
LinearInterpolator< float > LinearInterpolatorFloat_T
LinearInterpolatorDVec2(const std::vector< dvec2 > &path)
const LinearInterpolatorDouble_T * interpolator() const
const LinearInterpolatorDVec4_T * interpolator() const
void setInterpolator(LinearInterpolatorFloat_T *interpolator)
LinearInterpolator< fvec3 > LinearInterpolatorFVec3_T
ref< LinearInterpolatorFloat_T > mInterpolator
Abstract class that interpolates vl::dvec4 values.
LinearInterpolatorFVec3()
Abstract class that interpolates vl::dvec2 values.
LinearInterpolatorDouble(const std::vector< double > &path)
const LinearInterpolatorFloat_T * interpolator() const
LinearInterpolator< dvec2 > LinearInterpolatorDVec2_T
Abstract class that interpolates double values.
Abstract class that interpolates float values.
ref< LinearInterpolatorFVec2_T > mInterpolator
void setPath(const std::vector< T > &path)
The control points defining the Catmull-Rom spline.
Interpolates float values using a LinearInterpolator.
fvec3 computePoint(float t) const
Samples the interpolator at the given point.
Interpolates dvec4 values using a LinearInterpolator.
std::vector< T > mLinearSpline
dvec2 computePoint(float t) const
Samples the interpolator at the given point.
dvec3 computePoint(float t) const
Samples the interpolator at the given point.
LinearInterpolatorFVec2()
LinearInterpolatorFVec3_T * interpolator()
LinearInterpolator(const std::vector< T > &path)
LinearInterpolator< dvec3 > LinearInterpolatorDVec3_T
LinearInterpolatorDVec4_T * interpolator()
The LinearInterpolator class is a template class that implements linear interpolation.
LinearInterpolatorFloat(const std::vector< float > &path)
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
const std::vector< T > & path() const
The control points defining the Catmull-Rom spline.
std::vector< T > & path()
The control points defining the Catmull-Rom spline.
T computePoint(float t) const
Samples the path at the given point. The t parameter must be in the range 0.0 ... 1...
LinearInterpolatorDouble()
Visualization Library main namespace.
LinearInterpolatorFVec3(const std::vector< fvec3 > &path)
LinearInterpolatorDVec3()
double computePoint(float t) const
Samples the interpolator at the given point.
const LinearInterpolatorFVec4_T * interpolator() const
LinearInterpolatorDouble_T * interpolator()
ref< LinearInterpolatorDVec4_T > mInterpolator
LinearInterpolatorDVec4()
Interpolates fvec3 values using a LinearInterpolator.
void setInterpolator(LinearInterpolatorFVec3_T *interpolator)
void setInterpolator(LinearInterpolatorFVec4_T *interpolator)
Interpolates dvec2 values using a LinearInterpolator.
The base class for all the reference counted objects.
LinearInterpolatorDVec2()
LinearInterpolator< fvec2 > LinearInterpolatorFVec2_T
LinearInterpolator< fvec4 > LinearInterpolatorFVec4_T
LinearInterpolator< dvec4 > LinearInterpolatorDVec4_T
const LinearInterpolatorDVec3_T * interpolator() const
fvec2 computePoint(float t) const
Samples the interpolator at the given point.
void setInterpolator(LinearInterpolatorFVec2_T *interpolator)
LinearInterpolatorFVec4()
dvec4 computePoint(float t) const
Samples the interpolator at the given point.
ref< LinearInterpolatorDouble_T > mInterpolator
const LinearInterpolatorDVec2_T * interpolator() const
LinearInterpolatorFloat_T * interpolator()
fvec4 computePoint(float t) const
Samples the interpolator at the given point.
Interpolates fvec4 values using a LinearInterpolator.
void setInterpolator(LinearInterpolatorDVec4_T *interpolator)
LinearInterpolatorFVec2_T * interpolator()
ref< LinearInterpolatorFVec3_T > mInterpolator
LinearInterpolatorFloat()
Interpolates double values using a LinearInterpolator.
LinearInterpolatorDVec2_T * interpolator()
Abstract class that interpolates vl::fvec3 values.
void setInterpolator(LinearInterpolatorDVec3_T *interpolator)
The ref<> class is used to reference-count an Object.
ref< LinearInterpolatorDVec3_T > mInterpolator
const LinearInterpolatorFVec2_T * interpolator() const
LinearInterpolatorFVec4(const std::vector< fvec4 > &path)
LinearInterpolator< double > LinearInterpolatorDouble_T
Abstract class that interpolates vl::dvec3 values.
float computePoint(float t) const
Samples the interpolator at the given point.
LinearInterpolatorFVec2(const std::vector< fvec2 > &path)
const LinearInterpolatorFVec3_T * interpolator() const
void setInterpolator(LinearInterpolatorDouble_T *interpolator)
LinearInterpolatorDVec3_T * interpolator()
void setInterpolator(LinearInterpolatorDVec2_T *interpolator)
LinearInterpolatorDVec4(const std::vector< dvec4 > &path)
Abstract class that interpolates vl::fvec4 values.