diff options
author | Stijn Buys <ingar@osirion.org> | 2008-04-27 16:50:30 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-04-27 16:50:30 +0000 |
commit | 84d474fd3bd78f5ba6dcee65323f267fa8061b03 (patch) | |
tree | 45a2061ffe0a0eaf2675f5143859f2c06a233241 /src/math | |
parent | a4b36e6d1e20b5036d1ed7cf9f61a48dbbf77812 (diff) |
more 3D changes
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/axis.cc | 12 | ||||
-rw-r--r-- | src/math/vector3f.cc | 9 | ||||
-rw-r--r-- | src/math/vector3f.h | 3 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/math/axis.cc b/src/math/axis.cc index cbca99b..6f9710b 100644 --- a/src/math/axis.cc +++ b/src/math/axis.cc @@ -74,6 +74,18 @@ void Axis::change_roll(const float angle) { axis_vector[1].assign(up); } +/* +Axis const Axis::transpose() +{ + Axis` t; + + for (size_t i = 0; i < 3; i++) + for (size_t j = 0; j < 3; j++) + t.axis_vector[j][i] = axis_vector[j][i]; + return t; +} +*/ + // write an axis to a std::ostream std::ostream &operator<<(std::ostream & os, Axis const & axis) { diff --git a/src/math/vector3f.cc b/src/math/vector3f.cc index 51d0385..d5173bb 100644 --- a/src/math/vector3f.cc +++ b/src/math/vector3f.cc @@ -14,9 +14,9 @@ namespace math { Vector3f::Vector3f() : - x(coord[0]), y(coord[1]), z(coord[2]) + x(coord[0]), y(coord[1]), z(coord[2]) { - assign(0,0,0); + clear(); } Vector3f::Vector3f(const Vector3f &other) : @@ -35,6 +35,11 @@ Vector3f::~Vector3f() { } +void Vector3f::clear() +{ + memset(coord, 0, sizeof(coord)); +} + void Vector3f::assign(const float vx, const float vy, const float vz) { coord[0] = vx; diff --git a/src/math/vector3f.h b/src/math/vector3f.h index ddb9e38..1b4028f 100644 --- a/src/math/vector3f.h +++ b/src/math/vector3f.h @@ -44,6 +44,9 @@ public: ~Vector3f(); /* -- Assignment operators -- */ + /// assign (0, 0, 0) + void clear(); + /// assignment void assign(const float x, const float y, const float z); |