diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-21 19:06:15 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-21 19:06:15 +0000 |
commit | 8aa04fc836116a58f8ffd1e0c3539b9ea8a94ddf (patch) | |
tree | bb933edb3919ed67d05b098a6b97a73f01746762 /src/math/vector3f.h | |
parent | 41ad1e4c9e2a70d0a8811f4b035f0d3018045e61 (diff) |
dedicated server, entity transfer
Diffstat (limited to 'src/math/vector3f.h')
-rw-r--r-- | src/math/vector3f.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/math/vector3f.h b/src/math/vector3f.h index cc318b0..d338f50 100644 --- a/src/math/vector3f.h +++ b/src/math/vector3f.h @@ -60,7 +60,7 @@ public: /// perform an element-wise subtraction Vector3f& operator-=(const Vector3f &other); - /// perform ann element-wise addition + /// perform an element-wise addition Vector3f& operator+=(const Vector3f &other); /* -- Mathematical operators -- */ @@ -74,12 +74,9 @@ public: /// return the element-wise difference between two vectors Vector3f operator-(const Vector3f &other) const; - /// return the element-wise sumn of two vectors + /// return the element-wise sum of two vectors Vector3f operator+(const Vector3f &other) const; - /// return the vector cross-product - float operator*(const Vector3f &other) const; - /// comparison operator bool operator==(const Vector3f &other) const; @@ -99,10 +96,6 @@ public: return coord[index]; } - float &x; - float &y; - float &z; - /// Return the cartesian length of this vector float length() const; @@ -133,18 +126,28 @@ public: /// WARNING: vector must not be (0, 0, 0) static inline Vector3f normalized(const Vector3f& vector) { return (vector / vector.length()); } + float &x; + float &y; + float &z; + float coord[3]; }; /// Write a Vector3f to a std::ostream -std::ostream &operator<<(std::ostream & os, const Vector3f & vector); +std::ostream &operator<<(std::ostream & os, Vector3f const & vector); /// Read a Vector3d from a std::istream -std::istream &operator>>(std::istream & is, Vector3f& vector); +std::istream &operator>>(std::istream & is, Vector3f & vector); -/// scalar*Vector3f operators +/// scalar * Vector3f operators Vector3f operator*(float scalar, const Vector3f& vector); +/// vector cross product +const Vector3f crossproduct(Vector3f const& first, Vector3f const second); + +/// vetor dot product +float dotproduct(const Vector3f& first, const Vector3f& second); + } // namespace Math #endif // __INCLUDED_MATH_VECTOR3F_H__ |