Public Member Functions | Protected Attributes

gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER > Class Template Reference

A base representation of a parametric curve with SIZE component using DATA_TYPE as the data type, ORDER as the order for each component. More...

#include <ParametricCurve.h>

Collaboration diagram for gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ParametricCurve ()
 ParametricCurve (const ParametricCurve &other)
 ~ParametricCurve ()
ParametricCurveoperator= (const ParametricCurve &other)
void setWeights (DATA_TYPE weights[ORDER])
void setControlPoints (Vec< DATA_TYPE, SIZE > control_points[ORDER])
void setBasisMatrix (const Matrix< DATA_TYPE, ORDER, ORDER > &basis_matrix)
Vec< DATA_TYPE, SIZE > getInterpolatedValue (DATA_TYPE value) const
Vec< DATA_TYPE, SIZE > getInterpolatedDerivative (DATA_TYPE value) const

Protected Attributes

DATA_TYPE mWeights [ORDER]
Vec< DATA_TYPE, SIZE > mControlPoints [ORDER]
Matrix< DATA_TYPE, ORDER, ORDER > mBasisMatrix

Detailed Description

template<typename DATA_TYPE, unsigned SIZE, unsigned ORDER>
class gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >

A base representation of a parametric curve with SIZE component using DATA_TYPE as the data type, ORDER as the order for each component.

Template Parameters:
DATA_TYPE The data type to use for the components.
SIZE The number of components this curve has.
ORDER The order of this curve.
Since:
0.6.1

Definition at line 40 of file ParametricCurve.h.


Constructor & Destructor Documentation

template<typename DATA_TYPE , unsigned SIZE, unsigned ORDER>
gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::ParametricCurve (  ) 

Definition at line 61 of file ParametricCurve.h.

{
   for (unsigned int i = 0; i < ORDER; ++i)
   {
      mWeights[i] = (DATA_TYPE)1.0;
   }
}

template<typename DATA_TYPE , unsigned SIZE, unsigned ORDER>
gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::ParametricCurve ( const ParametricCurve< DATA_TYPE, SIZE, ORDER > &  other  ) 

Definition at line 71 of file ParametricCurve.h.

{
   *this = other;
}

template<typename DATA_TYPE , unsigned SIZE, unsigned ORDER>
gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::~ParametricCurve (  ) 

Definition at line 77 of file ParametricCurve.h.

{
}


Member Function Documentation

template<typename DATA_TYPE, unsigned SIZE, unsigned ORDER>
Vec< DATA_TYPE, SIZE > gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::getInterpolatedDerivative ( DATA_TYPE  value  )  const

Definition at line 155 of file ParametricCurve.h.

{
   Vec<DATA_TYPE, SIZE> ret_vec;
   DATA_TYPE power_vector[ORDER];
   DATA_TYPE exponent;
   DATA_TYPE coefficient[ORDER];

   for (unsigned int i = 0; i < ORDER; ++i)
   {
      exponent = static_cast<DATA_TYPE>(ORDER - i - 1);

      if (exponent > 0)
      {
         power_vector[i] = exponent * Math::pow(value, exponent - 1);
      }
      else
      {
         power_vector[i] = (DATA_TYPE)0.0;
      }
   }

   for (unsigned int column = 0; column < ORDER; ++column)
   {
      coefficient[column] = static_cast<DATA_TYPE>(0.0);

      for (unsigned int row = 0; row < ORDER; ++row)
      {
         coefficient[column] += power_vector[row] * mBasisMatrix[row][column];
      }

      ret_vec += coefficient[column] * mWeights[column] * mControlPoints[column];
   }

   return ret_vec;
}

template<typename DATA_TYPE, unsigned SIZE, unsigned ORDER>
Vec< DATA_TYPE, SIZE > gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::getInterpolatedValue ( DATA_TYPE  value  )  const

Definition at line 125 of file ParametricCurve.h.

{
   Vec<DATA_TYPE, SIZE> ret_vec;
   DATA_TYPE power_vector[ORDER];
   DATA_TYPE exponent;
   DATA_TYPE coefficient[ORDER];

   for (unsigned int i = 0; i < ORDER; ++i)
   {
      exponent = (DATA_TYPE)(ORDER - i - 1);
      power_vector[i] = Math::pow(value, exponent);
   }

   for (unsigned int column = 0; column < ORDER; ++column)
   {
      coefficient[column] = (DATA_TYPE)0.0;

      for (unsigned int row = 0; row < ORDER; ++row)
      {
         coefficient[column] += power_vector[row] * mBasisMatrix[row][column];
      }

      ret_vec += coefficient[column] * mWeights[column] * mControlPoints[column];
   }

   return ret_vec;
}

template<typename DATA_TYPE , unsigned SIZE, unsigned ORDER>
ParametricCurve< DATA_TYPE, SIZE, ORDER > & gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::operator= ( const ParametricCurve< DATA_TYPE, SIZE, ORDER > &  other  ) 

Definition at line 83 of file ParametricCurve.h.

{
   for (unsigned int i = 0; i < ORDER; ++i)
   {
      mWeights[i] = other.mWeights[i];
      mControlPoints[i] = other.mControlPoints[i];
   }

   mBasisMatrix = other.mBasisMatrix;

   return *this;
}

template<typename DATA_TYPE, unsigned SIZE, unsigned ORDER>
void gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::setBasisMatrix ( const Matrix< DATA_TYPE, ORDER, ORDER > &  basis_matrix  ) 

Definition at line 118 of file ParametricCurve.h.

{
   mBasisMatrix = basis_matrix;
}

template<typename DATA_TYPE, unsigned SIZE, unsigned ORDER>
void gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::setControlPoints ( Vec< DATA_TYPE, SIZE >  control_points[ORDER]  ) 
template<typename DATA_TYPE, unsigned SIZE, unsigned ORDER>
void gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::setWeights ( DATA_TYPE  weights[ORDER]  ) 

Definition at line 98 of file ParametricCurve.h.

{
   for (unsigned int i = 0; i < ORDER; ++i)
   {
      mWeights[i] = weights[i];
   }
}


Member Data Documentation

template<typename DATA_TYPE, unsigned SIZE, unsigned ORDER>
Matrix<DATA_TYPE, ORDER, ORDER> gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::mBasisMatrix [protected]

Definition at line 57 of file ParametricCurve.h.

template<typename DATA_TYPE, unsigned SIZE, unsigned ORDER>
Vec<DATA_TYPE, SIZE> gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::mControlPoints[ORDER] [protected]

Definition at line 56 of file ParametricCurve.h.

template<typename DATA_TYPE, unsigned SIZE, unsigned ORDER>
DATA_TYPE gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::mWeights[ORDER] [protected]

Definition at line 55 of file ParametricCurve.h.


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