diff options
author | Paul Gilbert | 2016-07-16 12:36:02 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-17 13:09:49 -0400 |
commit | 9b1efa3bf5696ea606b9374d216d4a1ecf52610b (patch) | |
tree | f747d0e110710a7002125b10a6101d55b7a1e929 /engines/titanic/star_control/fvector.cpp | |
parent | e1695101bc464fe1a4917f7cd25db38854c923e0 (diff) | |
download | scummvm-rg350-9b1efa3bf5696ea606b9374d216d4a1ecf52610b.tar.gz scummvm-rg350-9b1efa3bf5696ea606b9374d216d4a1ecf52610b.tar.bz2 scummvm-rg350-9b1efa3bf5696ea606b9374d216d4a1ecf52610b.zip |
TITANIC: Added FMatrix methods
Diffstat (limited to 'engines/titanic/star_control/fvector.cpp')
-rw-r--r-- | engines/titanic/star_control/fvector.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp index 39d303c4dc..a7520bf508 100644 --- a/engines/titanic/star_control/fvector.cpp +++ b/engines/titanic/star_control/fvector.cpp @@ -21,8 +21,30 @@ */ #include "titanic/star_control/fvector.h" +#include "common/algorithm.h" namespace Titanic { +void FVector::fn1(FVector *v) { + v->_x = (ABS(_x - _y) < 0.00001 && ABS(_y - _z) < 0.00001 && + ABS(_x - _z) < 0.00001) ? -_x : _x; + v->_y = _y; + v->_z = _z; +} + +void FVector::multiply(FVector *dest, const FVector *src) { + dest->_x = (src->_z * _y) - (_z * src->_y); + dest->_y = (src->_x * _z) - (_x * src->_z); + dest->_z = (src->_y * _x) - (_y * src->_x); +} + +void FVector::fn3() { + double hyp = sqrt(_x * _x + _y * _y + _z * _z); + assert(hyp); + + _x *= 1.0 / hyp; + _y *= 1.0 / hyp; + _z *= 1.0 / hyp; +} } // End of namespace Titanic |