16 template <
int N,
typename Real>
27 Real
const* times, Real
const* tension, Real
const* continuity,
43 virtual void Evaluate(Real
t,
unsigned int maxOrder,
51 void GetKeyInfo(Real t,
int& key, Real& dt)
const;
63 template <
int N,
typename Real>
68 template <
int N,
typename Real>
71 Real
const* continuity, Real
const*
bias)
75 if (numPoints < 2 || !points)
84 mBias.resize(numPoints);
85 std::copy(points, points + numPoints,
mPoints.begin());
86 std::copy(tension, tension + numPoints,
mTension.begin());
87 std::copy(continuity, continuity + numPoints,
mContinuity.begin());
88 std::copy(bias, bias + numPoints,
mBias.begin());
91 mA.resize(numSegments);
92 mB.resize(numSegments);
93 mC.resize(numSegments);
94 mD.resize(numSegments);
99 for (
int i = 1; i < numSegments - 1; ++i)
105 ComputePoly(numSegments - 2, numSegments - 1, numSegments, numSegments);
110 template <
int N,
typename Real>
inline 113 return static_cast<int>(
mPoints.size());
116 template <
int N,
typename Real>
inline 122 template <
int N,
typename Real>
inline 128 template <
int N,
typename Real>
inline 134 template <
int N,
typename Real>
inline 140 template <
int N,
typename Real>
157 dt /= (this->
mTime[key + 1] - this->
mTime[key]);
160 values[0] =
mA[key] + dt * (
mB[key] + dt * (
mC[key] + dt *
mD[key]));
164 values[1] =
mB[key] + dt * (
mC[key] * ((Real)2) +
mD[key] *
169 values[2] =
mC[key] * ((Real)2) +
mD[key] * (((Real)6) * dt);
172 values[3] = ((Real)6) *
mD[key];
182 template <
int N,
typename Real>
189 Real oneMinusT0 = (Real)1 -
mTension[i1];
192 Real oneMinusB0 = (Real)1 -
mBias[i1];
193 Real onePlusB0 = (Real)1 +
mBias[i1];
194 Real adj0 = ((Real)2)*dt / (this->mTime[i2] - this->mTime[i0]);
195 Real out0 = ((Real)0.5)*adj0*oneMinusT0*onePlusC0*onePlusB0;
196 Real out1 = ((Real)0.5)*adj0*oneMinusT0*oneMinusC0*oneMinusB0;
202 Real oneMinusT1 = (Real)1 -
mTension[i2];
205 Real oneMinusB1 = (Real)1 -
mBias[i2];
206 Real onePlusB1 = (Real)1 +
mBias[i2];
207 Real adj1 = ((Real)2)*dt / (this->mTime[i3] - this->mTime[i1]);
208 Real in0 = ((Real)0.5)*adj1*oneMinusT1*oneMinusC1*onePlusB1;
209 Real in1 = ((Real)0.5)*adj1*oneMinusT1*onePlusC1*oneMinusB1;
214 mA[i1] = mPoints[i1];
216 mC[i1] = ((Real)3)*diff - ((Real)2)*tOut - tIn;
217 mD[i1] = ((Real)-2)*diff + tOut + tIn;
220 template <
int N,
typename Real>
229 else if (t >= this->mTime[numSegments])
231 key = numSegments - 1;
232 dt = this->mTime[
numSegments] - this->mTime[numSegments - 1];
241 dt = t - this->mTime[i];
GLfixed GLfixed GLint GLint order
Real const * GetContinuities() const
std::vector< Vector< N, Real > > mA
void GetKeyInfo(Real t, int &key, Real &dt) const
std::vector< Vector< N, Real > > mB
std::vector< Real > mTime
Real const * GetBiases() const
Real const * GetTensions() const
GLenum GLsizei GLsizei GLint * values
std::vector< Real > mTension
virtual void Evaluate(Real t, unsigned int maxOrder, Vector< N, Real > values[4]) const
TCBSplineCurve(int numPoints, Vector< N, Real > const *points, Real const *times, Real const *tension, Real const *continuity, Real const *bias)
GLfixed GLfixed GLint GLint GLfixed points
std::vector< Real > mContinuity
#define LogError(message)
std::vector< Vector< N, Real > > mD
Vector< N, Real > const * GetPoints() const
GLsizei GLsizei numSegments
void ComputePoly(int i0, int i1, int i2, int i3)
std::vector< Vector< N, Real > > mPoints
std::vector< Vector< N, Real > > mC
virtual ~TCBSplineCurve()
std::vector< Real > mBias