23 inline Vector3(
const float fX,
const float fY,
const float fZ)
24 : x(fX), y(fY), z(fZ) {}
26 inline explicit Vector3(
const float afCoordinate[3])
31 inline explicit Vector3(
const int afCoordinate[3])
33 x = (float)afCoordinate[0];
34 y = (float)afCoordinate[1];
35 z = (float)afCoordinate[2];
38 inline explicit Vector3(
float*
const r)
39 : x(r[0]), y(r[1]), z(r[2]) {}
41 inline explicit Vector3(
const float scaler)
46 inline float operator [] (
const size_t i)
const 51 inline float& operator [] (
const size_t i)
61 inline const float*
ptr()
const 75 inline Vector3& operator = (
const float fScaler)
84 inline bool operator == (
const Vector3& rkVector)
const 86 return (x == rkVector.x && y == rkVector.y && z == rkVector.z);
89 inline bool operator != (
const Vector3& rkVector)
const 91 return (x != rkVector.x || y != rkVector.y || z != rkVector.z);
111 inline Vector3 operator * (
const float fScalar)
const 127 inline Vector3 operator / (
const float fScalar)
const 129 float fInv = 1.0f / fScalar;
145 inline const Vector3& operator + ()
const 150 inline Vector3 operator - ()
const 156 inline friend Vector3 operator * (
const float fScalar,
const Vector3& rkVector)
159 fScalar * rkVector.x,
160 fScalar * rkVector.y,
161 fScalar * rkVector.z);
164 inline friend Vector3 operator / (
const float fScalar,
const Vector3& rkVector)
167 fScalar / rkVector.x,
168 fScalar / rkVector.y,
169 fScalar / rkVector.z);
172 inline friend Vector3 operator + (
const Vector3& lhs,
const float rhs)
180 inline friend Vector3 operator + (
const float lhs,
const Vector3& rhs)
188 inline friend Vector3 operator - (
const Vector3& lhs,
const float rhs)
196 inline friend Vector3 operator - (
const float lhs,
const Vector3& rhs)
214 inline Vector3& operator += (
const float fScalar)
231 inline Vector3& operator -= (
const float fScalar)
239 inline Vector3& operator *= (
const float fScalar)
256 inline Vector3& operator /= (
const float fScalar)
258 float fInv = 1.0f / fScalar;
281 inline explicit Matrix3(
const float arr[3][3])
283 memcpy(m, arr, 9 *
sizeof(
float));
287 memcpy(m, rkMatrix.m, 9 *
sizeof(
float));
289 Matrix3(
float fEntry00,
float fEntry01,
float fEntry02,
290 float fEntry10,
float fEntry11,
float fEntry12,
291 float fEntry20,
float fEntry21,
float fEntry22)
304 inline const float* operator[] (
size_t iRow)
const 309 inline float* operator[] (
size_t iRow)
316 memcpy(m, rkMatrix.m, 9 *
sizeof(
float));
320 bool operator== (
const Matrix3& rkMatrix)
const;
322 inline bool operator!= (
const Matrix3& rkMatrix)
const 324 return !operator==(rkMatrix);
339 inline Quaternion() : w(1), x(0), y(0), z(0) {}
341 inline Quaternion(
float fW,
float fX,
float fY,
float fZ) : w(fW), x(fX), y(fY), z(fZ) {}
345 this->FromRotationMatrix(rot);
348 inline float operator [] (
const size_t i)
const 353 inline float& operator [] (
const size_t i)
358 void FromRotationMatrix(
const Matrix3& kRot);
370 return Quaternion(w + rkQ.w, x + rkQ.x, y + rkQ.y, z + rkQ.z);
374 return Quaternion(w - rkQ.w, x - rkQ.x, y - rkQ.y, z - rkQ.z);
380 w * rkQ.w - x * rkQ.x - y * rkQ.y - z * rkQ.z,
381 w * rkQ.x + x * rkQ.w + y * rkQ.z - z * rkQ.y,
382 w * rkQ.y + y * rkQ.w + z * rkQ.x - x * rkQ.z,
383 w * rkQ.z + z * rkQ.w + x * rkQ.y - y * rkQ.x
388 return Quaternion(fScalar*w, fScalar*x, fScalar*y, fScalar*z);
394 inline bool operator== (
const Quaternion& rhs)
const 396 return (rhs.x == x) && (rhs.y == y) && (rhs.z == z) && (rhs.w == w);
398 inline bool operator!= (
const Quaternion& rhs)
const 400 return !operator==(rhs);
406 inline const float*
ptr()
const 411 float normalise(
void);
428 float m00,
float m01,
float m02,
float m03,
429 float m10,
float m11,
float m12,
float m13,
430 float m20,
float m21,
float m22,
float m23,
431 float m30,
float m31,
float m32,
float m33)
457 inline void extract3x3Matrix(
Matrix3& m3x3)
const 459 m3x3.m[0][0] = m[0][0];
460 m3x3.m[0][1] = m[0][1];
461 m3x3.m[0][2] = m[0][2];
462 m3x3.m[1][0] = m[1][0];
463 m3x3.m[1][1] = m[1][1];
464 m3x3.m[1][2] = m[1][2];
465 m3x3.m[2][0] = m[2][0];
466 m3x3.m[2][1] = m[2][1];
467 m3x3.m[2][2] = m[2][2];
473 extract3x3Matrix(m3x3);
477 inline Vector3 getTrans()
const 479 return Vector3(m[0][3], m[1][3], m[2][3]);
481 inline void operator = (
const Matrix3& mat3)
483 m[0][0] = mat3.m[0][0]; m[0][1] = mat3.m[0][1]; m[0][2] = mat3.m[0][2];
484 m[1][0] = mat3.m[1][0]; m[1][1] = mat3.m[1][1]; m[1][2] = mat3.m[1][2];
485 m[2][0] = mat3.m[2][0]; m[2][1] = mat3.m[2][1]; m[2][2] = mat3.m[2][2];
487 inline float* operator [] (
size_t iRow)
492 inline const float *operator [] (
size_t iRow)
const 498 #endif //__VRMATHS_H__ float * ptr()
Pointer accessor for direct copying.
const float * ptr() const
Pointer accessor for direct copying.