diff options
author | erorcun <erayorcunus@gmail.com> | 2019-11-05 13:06:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-05 13:06:07 +0100 |
commit | e30fc9322ad0e18fa91ab690bcd1b4890c6e434f (patch) | |
tree | 804519d874a834b9ee10f96720420d9add1b3582 /src/math | |
parent | Merge pull request #266 from erorcun/erorcun (diff) | |
parent | RE cAudioManager::UpdateReflections (diff) | |
download | re3-e30fc9322ad0e18fa91ab690bcd1b4890c6e434f.tar re3-e30fc9322ad0e18fa91ab690bcd1b4890c6e434f.tar.gz re3-e30fc9322ad0e18fa91ab690bcd1b4890c6e434f.tar.bz2 re3-e30fc9322ad0e18fa91ab690bcd1b4890c6e434f.tar.lz re3-e30fc9322ad0e18fa91ab690bcd1b4890c6e434f.tar.xz re3-e30fc9322ad0e18fa91ab690bcd1b4890c6e434f.tar.zst re3-e30fc9322ad0e18fa91ab690bcd1b4890c6e434f.zip |
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/Vector.h | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/math/Vector.h b/src/math/Vector.h index 42087339..605d96ab 100644 --- a/src/math/Vector.h +++ b/src/math/Vector.h @@ -78,21 +78,6 @@ public: bool IsZero(void) { return x == 0.0f && y == 0.0f && z == 0.0f; } }; -inline float -DotProduct(const CVector &v1, const CVector &v2) -{ - return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z; -} - -inline 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); -} - inline CVector operator+(const CVector &left, const CVector &right) { return CVector(left.x + right.x, left.y + right.y, left.z + right.z); @@ -117,3 +102,24 @@ inline CVector operator/(const CVector &left, float right) { return CVector(left.x / right, left.y / right, left.z / right); } + +inline float +DotProduct(const CVector &v1, const CVector &v2) +{ + return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z; +} + +inline 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); +} + +inline float +Distance(const CVector &v1, const CVector &v2) +{ + return (v2 - v1).Magnitude(); +}
\ No newline at end of file |