General purpose float triple for use as vertices, vectors and normals.
Public Fields
-
float _v[3]
Public Methods
-
Vec3()
-
Vec3(float x, float y, float z)
-
inline const bool operator == (const Vec3& v) const
-
inline const bool operator != (const Vec3& v) const
-
inline const bool operator < (const Vec3& v) const
-
inline float* ptr()
-
inline const float* ptr() const
-
inline void set( float x, float y, float z)
-
inline float& operator [] (int i)
-
inline const float operator [] (int i) const
-
inline float& x()
-
inline float& y()
-
inline float& z()
-
inline const float x() const
-
inline const float y() const
-
inline const float z() const
-
inline const bool valid() const
-
inline const bool isNaN() const
-
inline float operator * (const Vec3& rhs) const
- dot product
-
inline const Vec3 operator ^ (const Vec3& rhs) const
- cross product
-
inline const Vec3 operator * (const float& rhs) const
- multiply by scalar
-
inline Vec3& operator *= (const float& rhs)
- unary multiply by scalar
-
inline const Vec3 operator / (const float& rhs) const
- divide by scalar
-
inline Vec3& operator /= (const float& rhs)
- unary divide by scalar
-
inline const Vec3 operator + (const Vec3& rhs) const
- binary vector add
-
inline Vec3& operator += (const Vec3& rhs)
- unary vector add.
-
inline const Vec3 operator - (const Vec3& rhs) const
- binary vector subtract
-
inline Vec3& operator -= (const Vec3& rhs)
- unary vector subtract
-
inline const Vec3 operator - () const
- negation operator.
-
inline const float length() const
- Length of the vector = sqrt( vec .
-
inline const float length2() const
- Length squared of the vector = vec .
-
inline const float normalize()
- normalize the vector so that it has length unity returns the previous length of the vector
Documentation
General purpose float triple for use as vertices, vectors and normals.
Provides general maths operations from addition through to cross products.
No support yet added for float * Vec3 - is it necessary?
Need to define a non-member non-friend operator* etc.
Vec3 * float is okay
- Vec3()
- Vec3(float x, float y, float z)
- float _v[3]
- inline const bool operator == (const Vec3& v) const
- inline const bool operator != (const Vec3& v) const
- inline const bool operator < (const Vec3& v) const
- inline float* ptr()
- inline const float* ptr() const
- inline void set( float x, float y, float z)
- inline float& operator [] (int i)
- inline const float operator [] (int i) const
- inline float& x()
- inline float& y()
- inline float& z()
- inline const float x() const
- inline const float y() const
- inline const float z() const
- inline const bool valid() const
- inline const bool isNaN() const
- inline float operator * (const Vec3& rhs) const
- dot product
- inline const Vec3 operator ^ (const Vec3& rhs) const
- cross product
- inline const Vec3 operator * (const float& rhs) const
- multiply by scalar
- inline Vec3& operator *= (const float& rhs)
- unary multiply by scalar
- inline const Vec3 operator / (const float& rhs) const
- divide by scalar
- inline Vec3& operator /= (const float& rhs)
- unary divide by scalar
- inline const Vec3 operator + (const Vec3& rhs) const
- binary vector add
- inline Vec3& operator += (const Vec3& rhs)
- unary vector add. Slightly more efficient because no temporary
intermediate object
- inline const Vec3 operator - (const Vec3& rhs) const
- binary vector subtract
- inline Vec3& operator -= (const Vec3& rhs)
- unary vector subtract
- inline const Vec3 operator - () const
- negation operator. Returns the negative of the Vec3
- inline const float length() const
- Length of the vector = sqrt( vec . vec )
- inline const float length2() const
- Length squared of the vector = vec . vec
- inline const float normalize()
- normalize the vector so that it has length unity
returns the previous length of the vector
- This class has no child classes.
- Friends:
- inline std::ostream& operator << (std::ostream& output, const Vec3& vec)
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.