X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FMath.hh;h=26c4b5180dc61395c97752bd133b606de9285b10;hp=c4e3484ebebc56b5bad7e05cee6c13f9ef657557;hb=72d4af22710317acffab861421c4364b1780b6fe;hpb=16d1a05b0777e97a45c48e2874aa4e5cc791282e diff --git a/src/Moof/Math.hh b/src/Moof/Math.hh index c4e3484..26c4b51 100644 --- a/src/Moof/Math.hh +++ b/src/Moof/Math.hh @@ -57,6 +57,27 @@ typedef cml::matrix< Scalar, cml::fixed<4,4>, typedef cml::quaternion< Scalar, cml::fixed<>, cml::vector_first, cml::positive_cross > Quaternion; +typedef cml::constants Constants; + + +inline Vector3& demoteVector(Vector3& left, const Vector4& right) +{ + left[0] = right[0]; + left[1] = right[1]; + left[2] = right[2]; + return left; +} + +inline Vector4& promoteVector(Vector4& left, const Vector3& right) +{ + left[0] = right[0]; + left[1] = right[1]; + left[2] = right[2]; + left[3] = 1.0; + return left; +} + + const Scalar EPSILON = 0.000001; @@ -64,7 +85,7 @@ const Scalar EPSILON = 0.000001; * Check the equality of scalars with a certain degree of error allowed. */ -inline bool checkEquality(Scalar a, Scalar b, Scalar epsilon = EPSILON) +inline bool isEqual(Scalar a, Scalar b, Scalar epsilon = EPSILON) { return std::abs(a - b) < epsilon; }