From 25d2c764443723eb7a3dd5f8bf0b76586c1ff10b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 5 Apr 2008 10:52:39 +0000 Subject: Makefile.am updates, math::Axis, improved VertexArray, r_arraysize --- src/math/axis.cc | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/math/axis.cc (limited to 'src/math/axis.cc') diff --git a/src/math/axis.cc b/src/math/axis.cc new file mode 100644 index 0000000..7bd5262 --- /dev/null +++ b/src/math/axis.cc @@ -0,0 +1,54 @@ +/* + math/axis.cc + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +// project headers +#include "math/axis.h" + +namespace math +{ + +Axis::Axis() +{ + clear(); +} + +Axis::Axis(const Axis & other) { + assign(other); +} + +void Axis::clear() +{ + axis_vector[0] = Vector3f(1.0f, 0.0f, 0.0f); + axis_vector[1] = Vector3f(0.0f, 1.0f, 0.0f); + axis_vector[2] = Vector3f(0.0f, 0.0f, 1.0f); +} + +void Axis::assign(const Axis & other) { + for (size_t i=0; i < 3; i++) { + axis_vector[i].assign(other.axis_vector[i]); + } +} + +Axis & Axis::operator=(const Axis & other) { + assign(other); + return *this; +} + +// alter heading, rotate around Z-axis (positive is left) +void Axis::direction(const float angle) { + for (size_t i=0; i < 3; i++) { + //axis_vector[i].rotate(axis_vector[2], angle); + } +} + +// alter heading, rotate around negative Y-axis (positive is up) +void Axis::pitch(const float pitch) { + for (size_t i=0; i < 3; i++) { + //axis_vector[i].rotate(axis_vector[1], -angle); + } +} + +} -- cgit v1.2.3