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

SFVec3f Class Reference

Encapsulates a SFVec3f value. More...

Inheritance diagram for SFVec3f:

FieldValue List of all members.

Public Types

typedef const float (&ConstArrayReference)[3]
typedef float(* ArrayPointer )[3]
typedef const float(* ConstArrayPointer )[3]

Public Methods

typedef float (&ArrayReference)[3]
 SFVec3f () throw ()
 Construct a SFVec3f with the default value, (0, 0, 0).

 SFVec3f (ConstArrayReference vec) throw ()
 Construct a SFVec3f.

 SFVec3f (float x, float y, float z) throw ()
 Construct a SFVec3f.

virtual ~SFVec3f () throw ()
 Destructor.

float operator[] (size_t index) const throw ()
 Array element dereference operator (const version).

float & operator[] (size_t index) throw ()
 Array element dereference operator (non-const version).

float getX () const throw ()
 Get the x-component.

void setX (float) throw ()
 Set the x-component.

float getY () const throw ()
 Get the y-component.

void setY (float) throw ()
 Set the y-component.

float getZ () const throw ()
 Get the z-component.

void setZ (float) throw ()
 Set the z-component.

ConstArrayReference get () const throw ()
 Get the vector value.

void set (ConstArrayReference vec) throw ()
 Set the vector value.

const SFVec3f add (const SFVec3f &vec) const throw ()
 Add this vector and vec component-wise.

const SFVec3f cross (const SFVec3f &vec) const throw ()
 Get the cross product of this vector and vec.

const SFVec3f divide (float number) const throw ()
 Get the result of dividing this vector by number.

double dot (const SFVec3f &vec) const throw ()
 Get the dot product of this vector and vec.

double length () const throw ()
 Get the length of this vector.

const SFVec3f multiply (float number) const throw ()
 Multiply by a scalar.

const SFVec3f negate () const throw ()
 Negate.

const SFVec3f normalize () const throw ()
 Normalize.

const SFVec3f subtract (const SFVec3f &vec) const throw ()
 Subtract.

virtual std::auto_ptr< FieldValueclone () const throw (std::bad_alloc)
 Virtual copy constructor.

virtual FieldValueassign (const FieldValue &value) throw (std::bad_cast)
 Virtual assignment.

virtual Type type () const throw ()
 Get the FieldValue::Type associated with this class.


Private Methods

virtual void print (std::ostream &) const
 Print to an output stream.


Private Attributes

float value [3]

Detailed Description

Encapsulates a SFVec3f value.


Constructor & Destructor Documentation

SFVec3f   throw ()
 

Construct a SFVec3f with the default value, (0, 0, 0).

SFVec3f ConstArrayReference    vec throw () [explicit]
 

Construct a SFVec3f.

Parameters:
vec a 3-element array

SFVec3f float    x,
float    y,
float    z
throw ()
 

Construct a SFVec3f.

Parameters:
x the x-component.
y the y-component.
z the z-component.

~SFVec3f   throw () [virtual]
 

Destructor.


Member Function Documentation

const SFVec3f add const SFVec3f &    vec const throw ()
 

Add this vector and vec component-wise.

Parameters:
vec a vector.

FieldValue & assign const FieldValue   value throw (std::bad_cast) [virtual]
 

Virtual assignment.

Parameters:
value the new value to give the object.
Returns:
a reference to the object.
Exceptions:
std::bad_cast if value is not an SFBool.

Implements FieldValue.

std::auto_ptr< FieldValue > clone   const throw (std::bad_alloc) [virtual]
 

Virtual copy constructor.

Returns:
a pointer to a copy of the object.
Exceptions:
std::bad_alloc if memory allocation fails.

Implements FieldValue.

const SFVec3f cross const SFVec3f &    vec const throw ()
 

Get the cross product of this vector and vec.

Parameters:
vec a vector.

const SFVec3f divide float    number const throw ()
 

Get the result of dividing this vector by number.

Parameters:
number a scalar value.

double dot const SFVec3f &    vec const throw ()
 

Get the dot product of this vector and vec.

Parameters:
vec a vector.

SFVec3f::ConstArrayReference get   const throw ()
 

Get the vector value.

Returns:
a reference to a 3-element array

float getX   const throw ()
 

Get the x-component.

Returns:
the x-component of this vector.

float getY   const throw ()
 

Get the y-component.

Returns:
the y-component of this vector.

float getZ   const throw ()
 

Get the z-component.

Returns:
the z-component of this vector.

double length   const throw ()
 

Get the length of this vector.

Returns:
the geometric length of the vector.

const SFVec3f multiply float    number const throw ()
 

Multiply by a scalar.

Parameters:
number 
Returns:
the product

const SFVec3f negate   const throw ()
 

Negate.

Returns:
the negatation of this vector

const SFVec3f normalize   const throw ()
 

Normalize.

Returns:
a copy of this vector normalized

float & operator[] size_t    index throw ()
 

Array element dereference operator (non-const version).

Parameters:
index a value from 0 - 2. 0 corresponds to the x-component, 1 corresponds to the y-component, and 2 corresponds to the z-component.

float operator[] size_t    index const throw ()
 

Array element dereference operator (const version).

Parameters:
index a value from 0 - 2. 0 corresponds to the x-component, 1 corresponds to the y-component, and 2 corresponds to the z-component.

void print std::ostream &    out const [private, virtual]
 

Print to an output stream.

Parameters:
out an output stream.

Implements FieldValue.

void set ConstArrayReference    vec throw ()
 

Set the vector value.

Parameters:
vec a 3-element array

void setX float    value throw ()
 

Set the x-component.

Parameters:
value the new x-component value.

void setY float    value throw ()
 

Set the y-component.

Parameters:
value the new y-component value.

void setZ float    value throw ()
 

Set the z-component.

Parameters:
value the new z-component value.

const SFVec3f subtract const SFVec3f &    vec const throw ()
 

Subtract.

Parameters:
vec 
Returns:
the difference between this vector and vec

FieldValue::Type type   const throw () [virtual]
 

Get the FieldValue::Type associated with this class.

Returns:
FieldValue::sfvec3f.

Implements FieldValue.