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-27 13:08:12 +0000
committerStijn Buys <ingar@osirion.org>2008-04-27 13:08:12 +0000
commita4b36e6d1e20b5036d1ed7cf9f61a48dbbf77812 (patch)
tree7efd0048fd8c10b1f04d427c78e3ac8da402f059 /src/math/axis.h
parentfe95954f9d17c9dade1827fe5d4cf8cffffddbce (diff)
3D flight
Diffstat (limited to 'src/math/axis.h')
-rw-r--r--src/math/axis.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/math/axis.h b/src/math/axis.h
index 73474ef..7e81d9a 100644
--- a/src/math/axis.h
+++ b/src/math/axis.h
@@ -25,28 +25,39 @@ public:
void assign(const Axis & other);
/// global coordinates of the X-axis in the local coordinates system
- inline Vector3f const & forward() { return axis_vector[0]; }
+ inline Vector3f const & forward() const { return axis_vector[0]; }
/// global coordinates of the Y-axis in the local coordinates system
- inline Vector3f const & left() { return axis_vector[1]; }
+ inline Vector3f const & left() const { 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 & up() const { return axis_vector[2]; }
- inline Vector3f const operator[](size_t index) { return axis_vector[index]; }
+ inline Vector3f & operator[](size_t index) { return axis_vector[index]; }
+
+ inline Vector3f const & operator[](size_t index) const { return axis_vector[index]; }
Axis & operator=(const Axis & other);
- /// alter heading, rotate around Z-axis (positive is left)
- void direction(const float angle);
+ /// change direction, rotate around up vector (positive is left)
+ void change_direction(const float angle);
+
+ /// change pitch, rotate around left vector (positive is up)
+ void change_pitch(const float angle);
- /// alter heading, rotate around negative Y-axis (positive is up)
- void pitch(const float angle);
+ /// change roll, rotate around forward vector (positive is left)
+ void change_roll(const float angle);
private:
Vector3f axis_vector[3];
};
+/// write an axis to a std::ostream
+std::ostream &operator<<(std::ostream & os, Axis const & axis);
+
+/// read an axis from a std::istream
+std::istream &operator>>(std::istream & is, Axis & axis);
+
}
#endif // __INCLUDED_MATH_AXIS_H__