Google

class osg::Vec2

General purpose float pair, uses include representation of texture coordinates.

Public Fields

[more]float _v[2]

Public Methods

[more] Vec2()
[more] Vec2(float x, float y)
[more]inline bool operator == (const Vec2& v) const
[more]inline bool operator != (const Vec2& v) const
[more]inline bool operator < (const Vec2& v) const
[more]inline float* ptr()
[more]inline const float* ptr() const
[more]inline void set( float x, float y )
[more]inline float& operator [] (int i)
[more]inline float operator [] (int i) const
[more]inline float& x()
[more]inline float& y()
[more]inline float x() const
[more]inline float y() const
[more]inline bool valid() const
[more]inline bool isNaN() const
[more]inline float operator * (const Vec2& rhs) const
dot product
[more]inline const Vec2 operator * (float rhs) const
multiply by scalar
[more]inline Vec2& operator *= (float rhs)
unary multiply by scalar
[more]inline const Vec2 operator / (float rhs) const
divide by scalar
[more]inline Vec2& operator /= (float rhs)
unary divide by scalar
[more]inline const Vec2 operator + (const Vec2& rhs) const
binary vector add
[more]inline Vec2& operator += (const Vec2& rhs)
unary vector add.
[more]inline const Vec2 operator - (const Vec2& rhs) const
binary vector subtract
[more]inline Vec2& operator -= (const Vec2& rhs)
unary vector subtract
[more]inline const Vec2 operator - () const
negation operator.
[more]inline float length() const
Length of the vector = sqrt( vec .
[more]inline float length2( void ) const
Length squared of the vector = vec .
[more]inline float normalize()
normalize the vector so that it has length unity returns the previous length of the vector


Documentation

General purpose float pair, uses include representation of texture coordinates. No support yet added for float * Vec2 - is it necessary? Need to define a non-member non-friend operator* etc. BTW: Vec2 * float is okay
o Vec2()

o Vec2(float x, float y)

ofloat _v[2]

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

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

oinline bool operator < (const Vec2& v) const

oinline float* ptr()

oinline const float* ptr() const

oinline void set( float x, float y )

oinline float& operator [] (int i)

oinline float operator [] (int i) const

oinline float& x()

oinline float& y()

oinline float x() const

oinline float y() const

oinline bool valid() const

oinline bool isNaN() const

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

oinline const Vec2 operator * (float rhs) const
multiply by scalar

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

oinline const Vec2 operator / (float rhs) const
divide by scalar

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

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

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

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

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

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

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

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

oinline 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 Vec2& vec)

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.