Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

vl::CatmullRomInterpolator< T > Class Template Reference

The LinearInterpolator class is a template class that implements Catmull-Rom spline interpolation. More...

#include <CatmullRomInterpolator.hpp>

Inheritance diagram for vl::CatmullRomInterpolator< T >:

vl::Object

List of all members.

Public Member Functions

 CatmullRomInterpolator ()
 CatmullRomInterpolator (const std::vector< T > &path)
void setupEndPoints (bool is_loop)
 Call this function after having specified the control points if you want to automatically generate the start/end control points.
computePoint (float t) const
 Samples the Catmull-Rom spline at the given point. The t parameter must be in the range 0.0 ... 1.0 included.
void setPath (const std::vector< T > &path)
 The control points defining the Catmull-Rom spline.
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.

Protected Attributes

std::vector< T > mPath
std::vector< T > mCatmullRomSpline


Detailed Description

template<typename T>
class vl::CatmullRomInterpolator< T >

The LinearInterpolator class is a template class that implements Catmull-Rom spline interpolation.

Catmull-Rom spline interpolation allows smoother interpolations than simple linear interpolation, is thus indicated for example when you want to smoothly interpolate from one position to another or from one color to another.

See also:
LinearInterpolator, Interpolator and the Interpolators Tutorial page.

Constructor & Destructor Documentation

template<typename T >
vl::CatmullRomInterpolator< T >::CatmullRomInterpolator (  )  [inline]

template<typename T >
vl::CatmullRomInterpolator< T >::CatmullRomInterpolator ( const std::vector< T > &  path  )  [inline]


Member Function Documentation

template<typename T >
void vl::CatmullRomInterpolator< T >::setupEndPoints ( bool  is_loop  )  [inline]

Call this function after having specified the control points if you want to automatically generate the start/end control points.

template<typename T >
T vl::CatmullRomInterpolator< T >::computePoint ( float  t  )  const [inline]

Samples the Catmull-Rom spline at the given point. The t parameter must be in the range 0.0 ... 1.0 included.

template<typename T >
void vl::CatmullRomInterpolator< T >::setPath ( const std::vector< T > &  path  )  [inline]

The control points defining the Catmull-Rom spline.

Because of the Catmull-Rom formula the interpolated path must start and end with an extra control point (one on each side) and cannot have less than 4 control points. You can also automatically generate such extra control points by calling the setupEndPoints() method.

template<typename T >
const std::vector<T>& vl::CatmullRomInterpolator< T >::path (  )  const [inline]

The control points defining the Catmull-Rom spline.

template<typename T >
std::vector<T>& vl::CatmullRomInterpolator< T >::path (  )  [inline]

The control points defining the Catmull-Rom spline.


Member Data Documentation

template<typename T >
std::vector<T> vl::CatmullRomInterpolator< T >::mPath [protected]

template<typename T >
std::vector<T> vl::CatmullRomInterpolator< T >::mCatmullRomSpline [protected]


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

Visualization Library v2010.06 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Jun 1 00:57:12 2010.
Permission is granted to use this page to write and publish articles regarding Visualization Library.