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>

Public Member Functions | |
| ParametricCurve () | |
| ParametricCurve (const ParametricCurve &other) | |
| ~ParametricCurve () | |
| ParametricCurve & | operator= (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 |
A base representation of a parametric curve with SIZE component using DATA_TYPE as the data type, ORDER as the order for each component.
| DATA_TYPE | The data type to use for the components. | |
| SIZE | The number of components this curve has. | |
| ORDER | The order of this curve. |
Definition at line 40 of file ParametricCurve.h.
| 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;
}
}
| gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::ParametricCurve | ( | const ParametricCurve< DATA_TYPE, SIZE, ORDER > & | other | ) |
Definition at line 71 of file ParametricCurve.h.
{
*this = other;
}
| gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::~ParametricCurve | ( | ) |
Definition at line 77 of file ParametricCurve.h.
{
}
| 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;
}
| 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;
}
| 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;
}
| 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;
}
| void gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::setControlPoints | ( | Vec< DATA_TYPE, SIZE > | control_points[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];
}
}
Matrix<DATA_TYPE, ORDER, ORDER> gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::mBasisMatrix [protected] |
Definition at line 57 of file ParametricCurve.h.
Vec<DATA_TYPE, SIZE> gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::mControlPoints[ORDER] [protected] |
Definition at line 56 of file ParametricCurve.h.
DATA_TYPE gmtl::ParametricCurve< DATA_TYPE, SIZE, ORDER >::mWeights[ORDER] [protected] |
Definition at line 55 of file ParametricCurve.h.
1.7.1