From 52d5bd18102bed9321a620e29581c480d084d44d Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 4 Jan 2013 21:32:30 +0100 Subject: [PATCH] [DEV] add absolute calculation of the vec3 --- etk/math/Vector3D.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/etk/math/Vector3D.h b/etk/math/Vector3D.h index ddc4983..9eac6c1 100644 --- a/etk/math/Vector3D.h +++ b/etk/math/Vector3D.h @@ -293,6 +293,22 @@ namespace etk { return (x*x)+(y*y)+(z*z); }; + /** + * @brief Set the absolute value of the vector + */ + void Abs(void) + { + if (x<0) { + x = -x; + } + if (y<0) { + y = -y; + } + if (z<0) { + z = -z; + } + }; + //rotations void RotateX(float angle)