Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SbVec3f Class Reference

The SbVec3f class is a 3 dimensional vector with floating point coordinates. More...

#include <Inventor/SbLinear.h>

Inheritance diagram for SbVec3f::

SbColor List of all members.

Public Methods

 SbVec3f (void)
 SbVec3f (const float v[3])
 SbVec3f (const float x, const float y, const float z)
 SbVec3f (const SbPlane &p0, const SbPlane &p1, const SbPlane &p2)
SbVec3f cross (const SbVec3f &v) const
float dot (const SbVec3f &v) const
SbBool equals (const SbVec3f &v, const float tolerance) const
SbVec3f getClosestAxis (void) const
const float * getValue (void) const
void getValue (float &x, float &y, float &z) const
float length (void) const
float sqrLength () const
void negate (void)
float normalize (void)
SbVec3f & setValue (const float v[3])
SbVec3f & setValue (const float x, const float y, const float z)
SbVec3f & setValue (const SbVec3f &barycentric, const SbVec3f &v0, const SbVec3f &v1, const SbVec3f &v2)
float & operator[] (const int i)
const float & operator[] (const int i) const
SbVec3f & operator *= (const float d)
SbVec3f & operator/= (const float d)
SbVec3f & operator+= (const SbVec3f &u)
SbVec3f & operator-= (const SbVec3f &u)
SbVec3f operator- (void) const
void print (FILE *fp) const

Friends

COIN_DLL_API SbVec3f operator * (const SbVec3f &v, const float d)
COIN_DLL_API SbVec3f operator * (const float d, const SbVec3f &v)
COIN_DLL_API SbVec3f operator/ (const SbVec3f &v, const float d)
COIN_DLL_API SbVec3f operator+ (const SbVec3f &v1, const SbVec3f &v2)
COIN_DLL_API SbVec3f operator- (const SbVec3f &v1, const SbVec3f &v2)
COIN_DLL_API int operator== (const SbVec3f &v1, const SbVec3f &v2)
COIN_DLL_API int operator!= (const SbVec3f &v1, const SbVec3f &v2)

Detailed Description

The SbVec3f class is a 3 dimensional vector with floating point coordinates.

This vector class is used by many other classes in Coin. It provides storage for a 3 dimensional vector aswell as simple floating point arithmetic operations.

See also:
SbVec2f, SbVec2s, SbVec4f.


Constructor & Destructor Documentation

SbVec3f::SbVec3f void
 

The default constructor does nothing. The vector coordinates will be uninitialized until you do a setValue() call.

SbVec3f::SbVec3f const float v[3]
 

Constructs an SbVec3f instance with initial values from v.

SbVec3f::SbVec3f const float x,
const float y,
const float z
 

Constructs an SbVec3f instance with the initial vector endpoint set to <x,y,z>.

SbVec3f::SbVec3f const SbPlane & p0,
const SbPlane & p1,
const SbPlane & p2
 

Constructs an SbVec3f instance by combining the three given planes. None of the planes should be parallel to any of the other two, otherwise a divide by zero error will occur.


Member Function Documentation

SbVec3f SbVec3f::cross const SbVec3f & v const
 

Returns the result of taking the cross product of this vector and v.

float SbVec3f::dot const SbVec3f & v const
 

Calculates and returns the result of taking the dot product of this vector and v.

SbBool SbVec3f::equals const SbVec3f & v,
const float tolerance
const
 

Compares the vector with v and returns TRUE if the largest distance between the vectors are larger than the square root of the given tolerance value.

SbVec3f SbVec3f::getClosestAxis void const
 

Return the vector representing the principal axis closest to this vector.

const float * SbVec3f::getValue void const
 

Returns a pointer to an array of three floats containing the x, y and z coordinates of the vector.

See also:
setValue().

void SbVec3f::getValue float & x,
float & y,
float & z
const
 

Returns the x, y and z coordinates of the vector.

See also:
setValue().

float SbVec3f::length void const
 

Return length of vector.

float SbVec3f::sqrLength void const
 

Returns the squared length of the vector.

void SbVec3f::negate void
 

Negate the vector (i.e. point it in the opposite direction).

float SbVec3f::normalize void
 

Normalize the vector to unit length. Return value is the original length of the vector before normalization.

If the vector is the null vector, no attempt at normalization will be done.

SbVec3f & SbVec3f::setValue const float v[3]
 

Set new coordinates for the vector from v. Returns reference to self.

See also:
getValue().

SbVec3f & SbVec3f::setValue const float x,
const float y,
const float z
 

Set new coordinates for the vector. Returns reference to self.

See also:
getValue().

SbVec3f & SbVec3f::setValue const SbVec3f & barycentric,
const SbVec3f & v0,
const SbVec3f & v1,
const SbVec3f & v2
 

Set this vector to be the average of v0, v1 and v2. The vector components are weighted by the barycentric vector.

See also:
getValue().

float & SbVec3f::operator[] const int i [inline]
 

Index operator. Returns modifiable x, y or z coordinate of vector.

See also:
getValue() and setValue().

const float & SbVec3f::operator[] const int i const [inline]
 

Index operator. Returns x, y or z coordinate of vector.

See also:
getValue() and setValue().

SbVec3f & SbVec3f::operator *= const float d
 

Multiply components of vector with value d. Returns reference to self.

SbVec3f & SbVec3f::operator/= const float d
 

Divides components of vector with value d. Returns reference to self.

SbVec3f & SbVec3f::operator+= const SbVec3f & u
 

Adds this vector and vector u. Returns reference to self.

SbVec3f & SbVec3f::operator-= const SbVec3f & u
 

Subtracts vector u from this vector. Returns reference to self.

SbVec3f SbVec3f::operator- void const
 

Non-destructive negation operator. Returns a new SbVec3f instance which points in the opposite direction of this vector.

See also:
negate().

void SbVec3f::print FILE * fp const
 

Dump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized compile.


Friends And Related Function Documentation

SbVec3f operator * const SbVec3f & v,
const float d
[friend]
 

Returns an SbVec3f instance which is the components of vector v multiplied with d.

SbVec3f operator * const float d,
const SbVec3f & v
[friend]
 

Returns an SbVec3f instance which is the components of vector v multiplied with d.

SbVec3f operator/ const SbVec3f & v,
const float d
[friend]
 

Returns an SbVec3f instance which is the components of vector v divided on the scalar factor d.

SbVec3f operator+ const SbVec3f & v1,
const SbVec3f & v2
[friend]
 

Returns an SbVec3f instance which is the sum of vectors v1 and v2.

SbVec3f operator- const SbVec3f & v1,
const SbVec3f & v2
[friend]
 

Returns an SbVec3f instance which is vector v2 subtracted from vector v1.

int operator== const SbVec3f & v1,
const SbVec3f & v2
[friend]
 

Returns 1 if v1 and v2 are exactly equal, 0 otherwise.

See also:
equals().

int operator!= const SbVec3f & v1,
const SbVec3f & v2
[friend]
 

Returns 1 if v1 and v2 are not equal, 0 if they are equal.

See also:
equals().


The documentation for this class was generated from the following files:
Generated at Tue Mar 5 03:31:32 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001