29 #ifndef __MATH_PLUECKER_H__
30 #define __MATH_PLUECKER_H__
45 explicit idPluecker(
const float a1,
const float a2,
const float a3,
const float a4,
const float a5,
const float a6 );
65 void Set(
const float a1,
const float a2,
const float a3,
const float a4,
const float a5,
const float a6 );
77 float Length(
void )
const;
86 const char *
ToString(
int precision = 2 )
const;
93 #define pluecker_zero pluecker_origin
99 memcpy(
p, a, 6 *
sizeof(
float ) );
106 ID_INLINE
idPluecker::idPluecker(
const float a1,
const float a2,
const float a3,
const float a4,
const float a5,
const float a6 ) {
132 return p[0] * a.
p[4] +
p[1] * a.
p[5] +
p[2] * a.
p[3] +
p[4] * a.
p[0] +
p[5] * a.
p[1] +
p[3] * a.
p[2];
140 return idPluecker(
p[0]*inva,
p[1]*inva,
p[2]*inva,
p[3]*inva,
p[4]*inva,
p[5]*inva );
144 return idPluecker(
p[0] + a[0],
p[1] + a[1],
p[2] + a[2],
p[3] + a[3],
p[4] + a[4],
p[5] + a[5] );
148 return idPluecker(
p[0] - a[0],
p[1] - a[1],
p[2] - a[2],
p[3] - a[3],
p[4] - a[4],
p[5] - a[5] );
196 return ( (
p[0] == a[0] ) && (
p[1] == a[1] ) && (
p[2] == a[2] ) &&
197 (
p[3] == a[3] ) && (
p[4] == a[4] ) && (
p[5] == a[5] ) );
236 ID_INLINE
void idPluecker::Set(
const float a1,
const float a2,
const float a3,
const float a4,
const float a5,
const float a6 ) {
246 p[0] =
p[1] =
p[2] =
p[3] =
p[4] =
p[5] = 0.0f;
250 p[0] = start[0] * end[1] - end[0] * start[1];
251 p[1] = start[0] * end[2] - end[0] * start[2];
252 p[2] = start[0] - end[0];
253 p[3] = start[1] * end[2] - end[1] * start[2];
254 p[4] = start[2] - end[2];
255 p[5] = end[1] - start[1];
259 p[0] = start[0] * dir[1] - dir[0] * start[1];
260 p[1] = start[0] * dir[2] - dir[0] * start[2];
262 p[3] = start[1] * dir[2] - dir[1] * start[2];
284 start = dir2.
Cross(dir1) * (1.0f / d);
306 start = dir.
Cross(dir1) * (1.0f / d);
317 return p[0] * a.
p[4] +
p[1] * a.
p[5] +
p[2] * a.
p[3] +
p[4] * a.
p[0] +
p[5] * a.
p[1] +
p[3] * a.
p[2];
325 return (
p[5] *
p[5] +
p[4] *
p[4] +
p[2] *
p[2] );
bool operator==(const idPluecker &a) const
assert(prefInfo.fullscreenBtn)
bool ToRay(idVec3 &start, idVec3 &dir) const
void ToDir(idVec3 &dir) const
idPluecker Normalize(void) const
idPluecker & operator+=(const idPluecker &a)
void Set(const float a1, const float a2, const float a3, const float a4, const float a5, const float a6)
static float Sqrt(float x)
int GetDimension(void) const
idPluecker operator-() const
idVec3 Cross(const idVec3 &a) const
idPluecker operator*(const float a) const
const char * ToString(int precision=2) const
void FromLine(const idVec3 &start, const idVec3 &end)
bool FromPlanes(const idPlane &p1, const idPlane &p2)
float operator[](const int index) const
bool Compare(const idPluecker &a) const
static float Fabs(float f)
float PermutedInnerProduct(const idPluecker &a) const
float NormalizeSelf(void)
idPluecker operator+(const idPluecker &a) const
static float InvSqrt(float x)
void FromRay(const idVec3 &start, const idVec3 &dir)
idPluecker & operator-=(const idPluecker &a)
GLubyte GLubyte GLubyte a
const float * ToFloatPtr(void) const
bool operator!=(const idPluecker &a) const
idPluecker operator/(const float a) const
idPluecker & operator/=(const float a)
idPluecker & operator*=(const float a)
idPluecker pluecker_origin
bool ToLine(idVec3 &start, idVec3 &end) const
float LengthSqr(void) const
float Distance3DSqr(const idPluecker &a) const