Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-04-05 10:52:39 +0000
committerStijn Buys <ingar@osirion.org>2008-04-05 10:52:39 +0000
commit25d2c764443723eb7a3dd5f8bf0b76586c1ff10b (patch)
treeb9cc681a3ff20900b32ce287505d018e0a7ae35f /src/math/axis.h
parent49e268d1b4244948e49a11612501a743e311fbaf (diff)
Makefile.am updates, math::Axis, improved VertexArray, r_arraysize
Diffstat (limited to 'src/math/axis.h')
-rw-r--r--src/math/axis.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/math/axis.h b/src/math/axis.h
new file mode 100644
index 0000000..73474ef
--- /dev/null
+++ b/src/math/axis.h
@@ -0,0 +1,52 @@
+/*
+ math/axis.h
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+#ifndef __INCLUDED_MATH_AXIS_H__
+#define __INCLUDED_MATH_AXIS_H__
+
+#include <iostream>
+
+#include "math/vector3f.h"
+
+namespace math
+{
+
+/// a local coordinates system
+class Axis {
+public:
+ Axis();
+ Axis(const Axis & other);
+
+ void clear();
+
+ void assign(const Axis & other);
+
+ /// global coordinates of the X-axis in the local coordinates system
+ inline Vector3f const & forward() { return axis_vector[0]; }
+
+ /// global coordinates of the Y-axis in the local coordinates system
+ inline Vector3f const & left() { return axis_vector[1]; }
+
+ /// global coordinates of the Z-axis in the local coordinates system
+ inline Vector3f const & up() { return axis_vector[2]; }
+
+ inline Vector3f const operator[](size_t index) { return axis_vector[index]; }
+
+ Axis & operator=(const Axis & other);
+
+ /// alter heading, rotate around Z-axis (positive is left)
+ void direction(const float angle);
+
+ /// alter heading, rotate around negative Y-axis (positive is up)
+ void pitch(const float angle);
+
+private:
+ Vector3f axis_vector[3];
+};
+
+}
+
+#endif // __INCLUDED_MATH_AXIS_H__