12 #include <initializer_list> 23 template <
typename Real>
72 template <
typename Real>
75 template <
typename Real>
79 template <
typename Real>
82 template <
typename Real>
85 template <
typename Real>
88 template <
typename Real>
91 template <
typename Real>
94 template <
typename Real>
97 template <
typename Real>
100 template <
typename Real>
103 template <
typename Real>
112 template <
typename Real>
115 template <
typename Real>
118 template <
typename Real>
128 template <
typename Real>
134 template <
typename Real>
139 template <
typename Real>
143 template <
typename Real>
149 template <
typename Real>
155 template <
typename Real>
159 template <
typename Real>
165 template <
typename Real>
171 template <
typename Real>
178 template <
typename Real>
181 #if defined(GTE_ASSERT_ON_GVECTOR_SIZE_MISMATCH) 182 LogAssert(size >= 0,
"Mismatched size.");
190 template <
typename Real>
inline 193 return static_cast<int>(
mTuple.size());
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>
250 template <
typename Real>
254 if (0 <= d && d < (
int)
mTuple.size())
260 template <
typename Real>
268 template <
typename Real>
278 template <
typename Real>
284 template <
typename Real>
288 for (
int i = 0; i < v.
GetSize(); ++i)
295 template <
typename Real>
302 template <
typename Real>
309 template <
typename Real>
313 return result *= scalar;
316 template <
typename Real>
320 return result *= scalar;
323 template <
typename Real>
327 return result /= scalar;
330 template <
typename Real>
335 for (
int i = 0; i < v0.
GetSize(); ++i)
342 #if defined(GTE_ASSERT_ON_GVECTOR_SIZE_MISMATCH) 349 template <
typename Real>
354 for (
int i = 0; i < v0.
GetSize(); ++i)
361 #if defined(GTE_ASSERT_ON_GVECTOR_SIZE_MISMATCH) 368 template <
typename Real>
371 for (
int i = 0; i < v.
GetSize(); ++i)
378 template <
typename Real>
381 if (scalar != (Real)0)
383 Real invScalar = ((Real)1) / scalar;
384 for (
int i = 0; i < v.
GetSize(); ++i)
391 for (
int i = 0; i < v.
GetSize(); ++i)
399 template <
typename Real>
404 Real dot = v0[0] * v1[0];
405 for (
int i = 1; i < v0.
GetSize(); ++i)
407 dot += v0[i] * v1[i];
413 #if defined(GTE_ASSERT_ON_GVECTOR_SIZE_MISMATCH) 420 template <
typename Real>
425 Real maxAbsComp = fabs(v[0]);
426 for (
int i = 1; i < v.
GetSize(); ++i)
428 Real absComp = fabs(v[i]);
429 if (absComp > maxAbsComp)
431 maxAbsComp = absComp;
436 if (maxAbsComp > (Real)0)
439 length = maxAbsComp * sqrt(
Dot(scaled, scaled));
449 return sqrt(
Dot(v, v));
453 template <
typename Real>
458 Real maxAbsComp = fabs(v[0]);
459 for (
int i = 1; i < v.
GetSize(); ++i)
461 Real absComp = fabs(v[i]);
462 if (absComp > maxAbsComp)
464 maxAbsComp = absComp;
469 if (maxAbsComp > (Real)0)
472 length = sqrt(
Dot(v, v));
474 length *= maxAbsComp;
479 for (
int i = 0; i < v.
GetSize(); ++i)
489 if (length > (Real)0)
495 for (
int i = 0; i < v.
GetSize(); ++i)
504 template <
typename Real>
507 if (v && 1 <= numInputs && numInputs <= v[0].
GetSize())
509 #if defined(GTE_ASSERT_ON_GVECTOR_SIZE_MISMATCH) 510 for (
int i = 1; i < numInputs; ++i)
515 Real minLength =
Normalize(v[0], robust);
516 for (
int i = 1; i < numInputs; ++i)
518 for (
int j = 0; j < i; ++j)
520 Real dot =
Dot(v[i], v[j]);
524 if (length < minLength)
536 template <
typename Real>
540 if (v && numVectors > 0)
542 #if defined(GTE_ASSERT_ON_GVECTOR_SIZE_MISMATCH) 543 for (
int i = 1; i < numVectors; ++i)
551 for (
int j = 1; j < numVectors; ++j)
554 for (
int i = 0; i <
size; ++i)
556 if (vec[i] < vmin[i])
560 else if (vec[i] > vmax[i])
573 template <
typename Real>
578 for (
int i = 0; i <
size; ++i)
586 template <
typename Real>
593 for (
int i = 0; i < size - 1; ++i)
605 template <
typename Real>
611 for (i = 0; i < inject; ++i)
617 for (++j; i <
size; ++i, ++j)
624 template <
typename Real>
631 for (
int i = 0, j = 0; i < size - 1; ++i, ++j)
GVector< Real > Project(GVector< Real > const &v, int reject)
#define LogAssert(condition, message)
DualQuaternion< Real > & operator*=(DualQuaternion< Real > &d, Real scalar)
bool operator<=(GVector const &vec) const
GLsizei const GLfloat * value
bool operator==(GVector const &vec) const
bool operator<(GVector const &vec) const
GVector< Real > HLift(GVector< Real > const &v, Real last)
std::vector< Real > mTuple
DualQuaternion< Real > operator+(DualQuaternion< Real > const &d)
GVector< Real > HProject(GVector< Real > const &v)
Real const & operator[](int i) const
bool operator>=(GVector const &vec) const
static GVector Unit(int size, int d)
#define LogError(message)
DualQuaternion< Real > & operator-=(DualQuaternion< Real > &d0, DualQuaternion< Real > const &d1)
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
Real Orthonormalize(int numElements, GVector< Real > *v, bool robust=false)
Real Normalize(GVector< Real > &v, bool robust=false)
GVector< Real > Lift(GVector< Real > const &v, int inject, Real value)
bool operator>(GVector const &vec) const
GLuint GLsizei GLsizei * length
DualQuaternion< Real > Length(DualQuaternion< Real > const &d, bool robust=false)
DualQuaternion< Real > operator-(DualQuaternion< Real > const &d)
DualQuaternion< Real > & operator+=(DualQuaternion< Real > &d0, DualQuaternion< Real > const &d1)
bool operator!=(GVector const &vec) const
DualQuaternion< Real > & operator/=(DualQuaternion< Real > &d, Real scalar)
bool ComputeExtremes(int numVectors, GVector< Real > const *v, GVector< Real > &vmin, GVector< Real > &vmax)
Vector4< float > operator*(Transform const &M, Vector4< float > const &V)
static GVector Zero(int size)
DualQuaternion< Real > operator/(DualQuaternion< Real > const &d, Real scalar)