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

osg::Vec3 Class Reference

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

List of all members.

Public Methods

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

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

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

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

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

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

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

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

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

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

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

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

const float length2 () 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 [3]

Friends

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


Detailed Description

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


Constructor & Destructor Documentation

osg::Vec3::Vec3   [inline]
 

osg::Vec3::Vec3 float    x,
float    y,
float    z
[inline]
 


Member Function Documentation

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

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

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

const float osg::Vec3::length2   const [inline]
 

Length squared of the vector = vec . vec.

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

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

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

multiply by scalar

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

dot product

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

unary multiply by scalar

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

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

binary vector add

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

unary vector add.

Slightly more efficient because no temporary intermediate object

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

negation operator. Returns the negative of the Vec3

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

binary vector subtract

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

unary vector subtract

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

divide by scalar

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

unary divide by scalar

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

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

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

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

const Vec3 osg::Vec3::operator^ const Vec3 &    rhs const [inline]
 

cross product

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

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

void osg::Vec3::set float    x,
float    y,
float    z
[inline]
 

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

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

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

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

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

const float osg::Vec3::z   const [inline]
 

float& osg::Vec3::z   [inline]
 


Friends And Related Function Documentation

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


Member Data Documentation

float osg::Vec3::_v[3]
 


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.