12 #include <initializer_list> 18 template <
typename Real>
40 inline Real
const&
operator[](
unsigned int i)
const;
46 inline bool operator< (Polynomial1<Real>
const&
p)
const;
47 inline bool operator<=(Polynomial1<Real>
const&
p)
const;
86 template <
typename Real>
89 template <
typename Real>
93 template <
typename Real>
97 template <
typename Real>
101 template <
typename Real>
105 template <
typename Real>
108 template <
typename Real>
111 template <
typename Real>
114 template <
typename Real>
117 template <
typename Real>
120 template <
typename Real>
123 template <
typename Real>
126 template <
typename Real>
130 template <
typename Real>
134 template <
typename Real>
138 template <
typename Real>
141 template <
typename Real>
144 template <
typename Real>
147 template <
typename Real>
151 template <
typename Real>
159 template <
typename Real>
167 template <
typename Real>
173 std::copy(values.begin(), values.end(),
mCoefficient.begin());
177 template <
typename Real>
183 template <
typename Real>
189 template <
typename Real>
inline 193 return static_cast<unsigned int>(
mCoefficient.size() - 1);
196 template <
typename Real>
inline 202 template <
typename Real>
inline 208 template <
typename Real>
inline 214 template <
typename Real>
inline 220 template <
typename Real>
inline 226 template <
typename Real>
inline 232 template <
typename Real>
inline 238 template <
typename Real>
inline 244 template <
typename Real>
249 for (--i; i >= 0; --i)
257 template <
typename Real>
264 for (
unsigned int i0 = 0, i1 = 1; i0 < degree; ++i0, ++i1)
278 template <
typename Real>
283 for (
unsigned int i = 0; i <= degree; ++i)
290 template <
typename Real>
296 Real
const zero = (Real)0;
298 for (leading = static_cast<int>(size) - 1; leading > 0; --leading)
310 template <
typename Real>
314 Real
const zero = (Real)0;
315 int divisorDegree =
static_cast<int>(divisor.
GetDegree());
316 int quotientDegree =
static_cast<int>(
GetDegree()) - divisorDegree;
317 if (quotientDegree >= 0)
325 Real inv = ((Real)1) / divisor[divisorDegree];
326 for (
int i = quotientDegree; i >= 0; --i)
328 int j = divisorDegree + i;
329 quotient[i] = inv*tmp[j];
330 for (j--; j >= i; j--)
332 tmp[j] -= quotient[i] * divisor[j - i];
337 int remainderDegree = divisorDegree - 1;
338 while (remainderDegree > 0 && tmp[remainderDegree] == zero)
344 for (
int i = 0; i <= remainderDegree; ++i)
346 remainder[i] = tmp[i];
359 template <
typename Real>
365 template <
typename Real>
368 unsigned int const degree = p.
GetDegree();
370 for (
unsigned int i = 0; i <= degree; ++i)
377 template <
typename Real>
383 if (p0Degree >= p1Degree)
386 for (i = 0; i <= p1Degree; ++i)
388 result[i] = p0[i] + p1[i];
390 for (; i <= p0Degree; ++i)
400 for (i = 0; i <= p0Degree; ++i)
402 result[i] = p0[i] + p1[i];
404 for (; i <= p1Degree; ++i)
413 template <
typename Real>
419 if (p0Degree >= p1Degree)
422 for (i = 0; i <= p1Degree; ++i)
424 result[i] = p0[i] - p1[i];
426 for (; i <= p0Degree; ++i)
436 for (i = 0; i <= p0Degree; ++i)
438 result[i] = p0[i] - p1[i];
440 for (; i <= p1Degree; ++i)
449 template <
typename Real>
456 for (
unsigned int i0 = 0; i0 <= p0Degree; ++i0)
458 for (
unsigned int i1 = 0; i1 <= p1Degree; ++i1)
460 result[i0 + i1] += p0[i0] * p1[i1];
466 template <
typename Real>
469 unsigned int const degree = p.
GetDegree();
471 result[0] = p[0] + scalar;
472 for (
unsigned int i = 1; i <= degree; ++i)
479 template <
typename Real>
482 unsigned int const degree = p.
GetDegree();
484 result[0] = p[0] + scalar;
485 for (
unsigned int i = 1; i <= degree; ++i)
492 template <
typename Real>
495 unsigned int const degree = p.
GetDegree();
497 result[0] = p[0] - scalar;
498 for (
unsigned int i = 1; i <= degree; ++i)
505 template <
typename Real>
508 unsigned int const degree = p.
GetDegree();
510 result[0] = scalar - p[0];
511 for (
unsigned int i = 1; i <= degree; ++i)
518 template <
typename Real>
521 unsigned int const degree = p.
GetDegree();
523 for (
unsigned int i = 0; i <= degree; ++i)
525 result[i] = scalar * p[i];
530 template <
typename Real>
533 unsigned int const degree = p.
GetDegree();
535 for (
unsigned int i = 0; i <= degree; ++i)
537 result[i] = scalar * p[i];
542 template <
typename Real>
545 if (scalar == (Real)0)
547 LogWarning(
"Division by zero in operator/(p,scalar).");
550 unsigned int const degree = p.
GetDegree();
551 Real invScalar = ((Real)1) / scalar;
553 for (
unsigned int i = 0; i <= degree; ++i)
555 result[i] = invScalar * p[i];
560 template <
typename Real>
568 template <
typename Real>
576 template <
typename Real>
584 template <
typename Real>
591 template <
typename Real>
598 template <
typename Real>
605 template <
typename Real>
Real const & operator[](unsigned int i) const
INT64 INT64 INT64 remainder
unsigned int GetDegree() const
void SetDegree(unsigned int degree)
Polynomial1 GetDerivative() const
DualQuaternion< Real > & operator*=(DualQuaternion< Real > &d, Real scalar)
bool operator<=(Polynomial1< Real > const &p) const
void SetCoefficients(Real value)
GLsizei const GLfloat * value
GLenum GLsizei GLsizei GLint * values
void Divide(Polynomial1 const &divisor, Polynomial1 "ient, Polynomial1 &remainder) const
std::vector< Real > mCoefficient
DualQuaternion< Real > operator+(DualQuaternion< Real > const &d)
DualQuaternion< Real > & operator-=(DualQuaternion< Real > &d0, DualQuaternion< Real > const &d1)
bool operator<(Polynomial1< Real > const &p) const
#define LogWarning(message)
Real operator()(Real t) const
bool operator!=(Polynomial1< Real > const &p) const
void EliminateLeadingZeros()
Polynomial1 GetInversion() const
DualQuaternion< Real > operator-(DualQuaternion< Real > const &d)
bool operator>(Polynomial1< Real > const &p) const
bool operator==(Polynomial1< Real > const &p) const
DualQuaternion< Real > & operator+=(DualQuaternion< Real > &d0, DualQuaternion< Real > const &d1)
DualQuaternion< Real > & operator/=(DualQuaternion< Real > &d, Real scalar)
bool operator>=(Polynomial1< Real > const &p) const
Vector4< float > operator*(Transform const &M, Vector4< float > const &V)
DualQuaternion< Real > operator/(DualQuaternion< Real > const &d, Real scalar)