summaryrefslogtreecommitdiffstats
path: root/src/math/Vector.h
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-09-26 12:28:33 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-09-26 12:28:33 +0200
commiteefb0c817f1c86cb24d3a730da848e1f98277948 (patch)
treed4872bafd56e69213a6e973ac539c01942042a01 /src/math/Vector.h
parentMerge remote-tracking branch 'upstream/master' (diff)
parentFix MASTER build with glfw (diff)
downloadre3-eefb0c817f1c86cb24d3a730da848e1f98277948.tar
re3-eefb0c817f1c86cb24d3a730da848e1f98277948.tar.gz
re3-eefb0c817f1c86cb24d3a730da848e1f98277948.tar.bz2
re3-eefb0c817f1c86cb24d3a730da848e1f98277948.tar.lz
re3-eefb0c817f1c86cb24d3a730da848e1f98277948.tar.xz
re3-eefb0c817f1c86cb24d3a730da848e1f98277948.tar.zst
re3-eefb0c817f1c86cb24d3a730da848e1f98277948.zip
Diffstat (limited to 'src/math/Vector.h')
-rw-r--r--src/math/Vector.h36
1 files changed, 9 insertions, 27 deletions
diff --git a/src/math/Vector.h b/src/math/Vector.h
index 5918a5d1..7ee01149 100644
--- a/src/math/Vector.h
+++ b/src/math/Vector.h
@@ -24,24 +24,7 @@ public:
float MagnitudeSqr(void) const { return x*x + y*y + z*z; }
float Magnitude2D(void) const { return Sqrt(x*x + y*y); }
float MagnitudeSqr2D(void) const { return x*x + y*y; }
- void Normalise(void) {
- float sq = MagnitudeSqr();
- if(sq > 0.0f){
- float invsqrt = RecipSqrt(sq);
- x *= invsqrt;
- y *= invsqrt;
- z *= invsqrt;
- }else
- x = 1.0f;
- }
-
- void Normalise(float norm) {
- float sq = MagnitudeSqr();
- float invsqrt = RecipSqrt(norm, sq);
- x *= invsqrt;
- y *= invsqrt;
- z *= invsqrt;
- }
+ void Normalise(void);
void Normalise2D(void) {
float sq = MagnitudeSqr2D();
@@ -124,17 +107,16 @@ DotProduct(const CVector &v1, const CVector &v2)
return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
}
-inline const CVector
-CrossProduct(const CVector &v1, const CVector &v2)
-{
- return CVector(
- v1.y*v2.z - v1.z*v2.y,
- v1.z*v2.x - v1.x*v2.z,
- v1.x*v2.y - v1.y*v2.x);
-}
+CVector CrossProduct(const CVector &v1, const CVector &v2);
inline float
Distance(const CVector &v1, const CVector &v2)
{
return (v2 - v1).Magnitude();
-} \ No newline at end of file
+}
+
+class CMatrix;
+
+CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
+CVector Multiply3x3(const CVector &vec, const CMatrix &mat);
+CVector operator*(const CMatrix &mat, const CVector &vec); \ No newline at end of file