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-10-12 11:14:22 +0000
committerStijn Buys <ingar@osirion.org>2008-10-12 11:14:22 +0000
commit18383a5fc596bf9546f14d7393ee66c57720b116 (patch)
tree5382c3b380a72149eabbc4f75a2c5744b895e48a /src/math/axis.h
parent0d831968949b1119db48530a86c2d1651c6cbfc6 (diff)
libmath API cleanup
Diffstat (limited to 'src/math/axis.h')
-rw-r--r--src/math/axis.h55
1 files changed, 33 insertions, 22 deletions
diff --git a/src/math/axis.h b/src/math/axis.h
index 1396521..38c68de 100644
--- a/src/math/axis.h
+++ b/src/math/axis.h
@@ -15,57 +15,68 @@ namespace math
{
/// a local coordinates system
-class Axis {
+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() const { return axis_vector[0]; }
-
+ inline const Vector3f & forward() const {
+ return axis_vector[0];
+ }
+
/// global coordinates of the Y-axis in the local coordinates system
- inline Vector3f const & left() const { return axis_vector[1]; }
+ inline const Vector3f & left() const {
+ return axis_vector[1];
+ }
/// global coordinates of the Z-axis in the local coordinates system
- inline Vector3f const & up() const { return axis_vector[2]; }
-
- inline Vector3f & operator[](size_t index) { return axis_vector[index]; }
-
- inline Vector3f const & operator[](size_t index) const { return axis_vector[index]; }
-
+ inline const Vector3f & up() const {
+ return axis_vector[2];
+ }
+
+ inline Vector3f & operator[](size_t index) {
+ return axis_vector[index];
+ }
+
+ inline const Vector3f & operator[](size_t index) const {
+ return axis_vector[index];
+ }
+
Axis & operator=(const Axis & other);
-
+
/// 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);
-
+
/// change roll, rotate around forward vector (positive is left)
void change_roll(const float angle);
-
+
/// rotation about an arbitrary axis
- void rotate(Vector3f const &normal, float angle);
-
+ void rotate(const Vector3f & normal, const float angle);
+
/// return the transpose of this matrix
Axis transpose() const;
-
+
private:
Vector3f axis_vector[3];
};
/// write an axis to a std::ostream
-std::ostream &operator<<(std::ostream & os, Axis const & axis);
+std::ostream &operator<<(std::ostream & os, const Axis & axis);
/// read an axis from a std::istream
std::istream &operator>>(std::istream & is, Axis & axis);
/// local-to-global coordinates
-Vector3f operator*(Axis const &axis, Vector3f const &vector);
+Vector3f operator*(const Axis &axis, const Vector3f &vector);
}