class osg::Vec3

General purpose float triple for use as vertices, vectors and normals.

Public Fields

[more]float _v[3]

Public Methods

[more] Vec3()
[more] Vec3(float x, float y, float z)
[more]inline const bool operator == (const Vec3& v) const
[more]inline const bool operator != (const Vec3& v) const
[more]inline const bool operator < (const Vec3& v) const
[more]inline float* ptr()
[more]inline const float* ptr() const
[more]inline void set( float x, float y, float z)
[more]inline float& operator [] (int i)
[more]inline const float operator [] (int i) const
[more]inline float& x()
[more]inline float& y()
[more]inline float& z()
[more]inline const float x() const
[more]inline const float y() const
[more]inline const float z() const
[more]inline const bool valid() const
[more]inline const bool isNaN() const
[more]inline float operator * (const Vec3& rhs) const
dot product
[more]inline const Vec3 operator ^ (const Vec3& rhs) const
cross product
[more]inline const Vec3 operator * (const float& rhs) const
multiply by scalar
[more]inline Vec3& operator *= (const float& rhs)
unary multiply by scalar
[more]inline const Vec3 operator / (const float& rhs) const
divide by scalar
[more]inline Vec3& operator /= (const float& rhs)
unary divide by scalar
[more]inline const Vec3 operator + (const Vec3& rhs) const
binary vector add
[more]inline Vec3& operator += (const Vec3& rhs)
unary vector add.
[more]inline const Vec3 operator - (const Vec3& rhs) const
binary vector subtract
[more]inline Vec3& operator -= (const Vec3& rhs)
unary vector subtract
[more]inline const Vec3 operator - () const
negation operator.
[more]inline const float length() const
Length of the vector = sqrt( vec .
[more]inline const float length2() const
Length squared of the vector = vec .
[more]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
o Vec3()

o Vec3(float x, float y, float z)

ofloat _v[3]

oinline const bool operator == (const Vec3& v) const

oinline const bool operator != (const Vec3& v) const

oinline const bool operator < (const Vec3& v) const

oinline float* ptr()

oinline const float* ptr() const

oinline void set( float x, float y, float z)

oinline float& operator [] (int i)

oinline const float operator [] (int i) const

oinline float& x()

oinline float& y()

oinline float& z()

oinline const float x() const

oinline const float y() const

oinline const float z() const

oinline const bool valid() const

oinline const bool isNaN() const

oinline float operator * (const Vec3& rhs) const
dot product

oinline const Vec3 operator ^ (const Vec3& rhs) const
cross product

oinline const Vec3 operator * (const float& rhs) const
multiply by scalar

oinline Vec3& operator *= (const float& rhs)
unary multiply by scalar

oinline const Vec3 operator / (const float& rhs) const
divide by scalar

oinline Vec3& operator /= (const float& rhs)
unary divide by scalar

oinline const Vec3 operator + (const Vec3& rhs) const
binary vector add

oinline Vec3& operator += (const Vec3& rhs)
unary vector add. Slightly more efficient because no temporary intermediate object

oinline const Vec3 operator - (const Vec3& rhs) const
binary vector subtract

oinline Vec3& operator -= (const Vec3& rhs)
unary vector subtract

oinline const Vec3 operator - () const
negation operator. Returns the negative of the Vec3

oinline const float length() const
Length of the vector = sqrt( vec . vec )

oinline const float length2() const
Length squared of the vector = vec . vec

oinline 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++.