Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osg::Vec2 Class Reference

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

List of all members.

Public Methods

 Vec2 ()
 Vec2 (float x, float y)
const bool operator== (const Vec2 &v) const
const bool operator!= (const Vec2 &v) const
const bool operator< (const Vec2 &v) const
float * ptr ()
const float * ptr () const
void set (float x, float y)
float & operator[] (int i)
const float operator[] (int i) const
float & x ()
float & y ()
const float x () const
const float y () const
const bool valid () const
const bool isNaN () const
const float operator * (const Vec2 &rhs) const
 dot product

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

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

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

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

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

Vec2 & operator+= (const Vec2 &rhs)
 unary vector add.

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

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

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

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

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

const float normalize ()
 normalize the vector so that it has length unity returns the previous length of the vector


Public Attributes

float _v [2]

Friends

std::ostream & operator<< (std::ostream &output, const Vec2 &vec)


Detailed Description

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


Constructor & Destructor Documentation

osg::Vec2::Vec2   [inline]
 

osg::Vec2::Vec2 float    x,
float    y
[inline]
 


Member Function Documentation

const bool osg::Vec2::isNaN   const [inline]
 

const float osg::Vec2::length   const [inline]
 

Length of the vector = sqrt( vec . vec ).

const float osg::Vec2::length2 void    const [inline]
 

Length squared of the vector = vec . vec.

const float osg::Vec2::normalize   [inline]
 

normalize the vector so that it has length unity returns the previous length of the vector

const Vec2 osg::Vec2::operator * const float &    rhs const [inline]
 

multiply by scalar

const float osg::Vec2::operator * const Vec2 &    rhs const [inline]
 

dot product

Vec2& osg::Vec2::operator *= const float &    rhs [inline]
 

unary multiply by scalar

const bool osg::Vec2::operator!= const Vec2 &    v const [inline]
 

const Vec2 osg::Vec2::operator+ const Vec2 &    rhs const [inline]
 

binary vector add

Vec2& osg::Vec2::operator+= const Vec2 &    rhs [inline]
 

unary vector add.

Slightly more efficient because no temporary intermediate object.

const Vec2 osg::Vec2::operator-   const [inline]
 

negation operator. Returns the negative of the Vec2

const Vec2 osg::Vec2::operator- const Vec2 &    rhs const [inline]
 

binary vector subtract

Vec2& osg::Vec2::operator-= const Vec2 &    rhs [inline]
 

unary vector subtract

const Vec2 osg::Vec2::operator/ const float &    rhs const [inline]
 

divide by scalar

Vec2& osg::Vec2::operator/= const float &    rhs [inline]
 

unary divide by scalar

const bool osg::Vec2::operator< const Vec2 &    v const [inline]
 

const bool osg::Vec2::operator== const Vec2 &    v const [inline]
 

const float osg::Vec2::operator[] int    i const [inline]
 

float& osg::Vec2::operator[] int    i [inline]
 

const float* osg::Vec2::ptr   const [inline]
 

float* osg::Vec2::ptr   [inline]
 

void osg::Vec2::set float    x,
float    y
[inline]
 

const bool osg::Vec2::valid   const [inline]
 

const float osg::Vec2::x   const [inline]
 

float& osg::Vec2::x   [inline]
 

const float osg::Vec2::y   const [inline]
 

float& osg::Vec2::y   [inline]
 


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &    output,
const Vec2 &    vec
[friend]
 


Member Data Documentation

float osg::Vec2::_v[2]
 


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:47 2002 for the Open Scene Graph by doxygen 1.2.16.