## class osg::Vec4

> General purpose float quad, uses include representation of colour coordinates.

### Public Fields

float _v[4]

### Public Methods

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

## Documentation

> General purpose float quad, uses include representation of colour coordinates. No support yet added for float * Vec4 - is it necessary? Need to define a non-member non-friend operator* etc. Vec4 * float is okay

`Vec4()`

`Vec4(float x, float y, float z, float w)`

`Vec4(const Vec3& v3, float w)`

`float _v[4]`

`inline bool operator == (const Vec4& v) const`

`inline bool operator != (const Vec4& v) const`

`inline bool operator < (const Vec4& v) const`

`inline float* ptr()`

`inline const float* ptr() const`

`inline void set( float x, float y, float z, float w)`

`inline float& operator [] (unsigned int i)`

`inline float operator [] (unsigned int i) const`

`inline float& x()`

`inline float& y()`

`inline float& z()`

`inline float& w()`

`inline float x() const`

`inline float y() const`

`inline float z() const`

`inline float w() const`

`inline unsigned long asABGR() const`

`inline unsigned long asRGBA() const`

`inline bool valid() const`

`inline bool isNaN() const`

`inline float operator * (const Vec4& rhs) const`
  dot product

`inline Vec4 operator * (float rhs) const`
  multiply by scalar

`inline Vec4& operator *= (float rhs)`
  unary multiply by scalar

`inline Vec4 operator / (float rhs) const`
  divide by scalar

`inline Vec4& operator /= (float rhs)`
  unary divide by scalar

`inline Vec4 operator + (const Vec4& rhs) const`
  binary vector add

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

`inline Vec4 operator - (const Vec4& rhs) const`
  binary vector subtract

`inline Vec4& operator -= (const Vec4& rhs)`
  unary vector subtract

`inline const Vec4 operator - () const`
  negation operator. Returns the negative of the Vec4

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

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

`inline 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 Vec4& vec)

Alphabetic index HTML hierarchy of classes or Java

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