vec3 Class Reference

A 3-dimensional double vector and methods to operate on them. More...

#include <matvec3D.h>

Inheritance diagram for vec3:
Inheritance graph
[legend]

List of all members.

Public Member Functions

double len () const
double len_sq () const
vec3 const & operator*= (double s)
vec3 const & operator+= (vec3 const &v)
vec3 const & operator-= (vec3 const &v)
vec3 const & operator/= (double s)
bool operator< (vec3 const &v) const
vec3 const & operator= (vec3 const &v)
bool operator== (vec3 const &v) const
double & operator[] (int i)
const double & operator[] (int i) const
void perpVectors (vec3 &v1, vec3 &v2)
void set (const SbVec3f &v)
void set (double x, double y, double z)
void set (double v[3])
void set (const vec3 &v)
SbVec3f toSbVec3f () const
void toSbVec3f (SbVec3f &v) const
 vec3 (double x, double y, double z)
 vec3 (const SbVec3f &v)
 vec3 (double v[3])
 vec3 (const vec3 &v)
 vec3 ()
double & x ()
double x () const
double & y ()
double y () const
double & z ()
double z () const

Static Public Attributes

static const vec3 X
 The vector [1,0,0].
static const vec3 Y
 The vector [0,1,0].
static const vec3 Z
 The vector [0,0,1].
static const vec3 ZERO
 The vector [0,0,0].

Private Attributes

double vec [3]
 Storarge for the 3 vector coordinates.

Friends

vec3 normalise (vec3 const &v)
double operator% (vec3 const &v, position const &p)
double operator% (position const &p, vec3 const &v)
double operator% (vec3 const &v1, vec3 const &v2)
vec3 operator* (vec3 const &v1, vec3 const &v2)
vec3 operator* (vec3 const &v, transf const &tr)
vec3 operator* (mat3 const &m, vec3 const &v)
vec3 operator* (vec3 const &v, double s)
vec3 operator* (double s, vec3 const &v)
vec3 operator+ (vec3 const &v1, vec3 const &v2)
vec3 operator- (vec3 const &v)
vec3 operator- (vec3 const &v1, vec3 const &v2)
vec3 operator/ (vec3 const &v, double s)
std::ostream & operator<< (std::ostream &os, const vec3 &v)
vec3 operator> (vec3 const &v, transf const &tr)
std::istream & operator>> (std::istream &is, vec3 &v)

Detailed Description

A 3-dimensional double vector and methods to operate on them.

vec3 is stored as an array of 3 doubles.

Definition at line 53 of file matvec3D.h.


Constructor & Destructor Documentation

vec3::vec3 (  )  [inline]

Default constructor, vector is uninitialized.

Definition at line 60 of file matvec3D.h.

vec3::vec3 ( const vec3 v  )  [inline]

Copy constructor.

Definition at line 63 of file matvec3D.h.

vec3::vec3 ( double  v[3]  )  [inline]

Initializes the vector with the three values in the array v.

Definition at line 66 of file matvec3D.h.

vec3::vec3 ( const SbVec3f &  v  )  [inline]

Initializes the vector with the values from the Inventor vector v.

Definition at line 69 of file matvec3D.h.

vec3::vec3 ( double  x,
double  y,
double  z 
) [inline]

Initializes the vector with the values x,y,z.

Definition at line 72 of file matvec3D.h.


Member Function Documentation

double vec3::len (  )  const [inline]

Returns the length of this vector.

Definition at line 612 of file matvec3D.h.

double vec3::len_sq (  )  const [inline]

Returns the squared length of this vector.

Definition at line 621 of file matvec3D.h.

vec3 const & vec3::operator*= ( double  s  )  [inline]

Scales this vector by s.

Definition at line 636 of file matvec3D.h.

vec3 const & vec3::operator+= ( vec3 const &  v  )  [inline]

Adds vector v to this vector.

Definition at line 659 of file matvec3D.h.

vec3 const & vec3::operator-= ( vec3 const &  v  )  [inline]

Subtract vector v from this vector.

Definition at line 667 of file matvec3D.h.

vec3 const & vec3::operator/= ( double  s  )  [inline]

Scales this vector by 1/s.

Definition at line 675 of file matvec3D.h.

bool vec3::operator< ( vec3 const &  v  )  const [inline]

Compares 2 vectors lexigraphically. Returns true if this vector comes before vector v. Vectors are ordered on z axis then y and then x.

Definition at line 695 of file matvec3D.h.

vec3 const & vec3::operator= ( vec3 const &  v  )  [inline]

Copies the vector v.

Definition at line 628 of file matvec3D.h.

bool vec3::operator== ( vec3 const &  v  )  const [inline]

Compares if 2 vectors are within resabs distance from each other.

Definition at line 683 of file matvec3D.h.

double& vec3::operator[] ( int  i  )  [inline]

Returns a reference to the value at index i.

Definition at line 78 of file matvec3D.h.

const double& vec3::operator[] ( int  i  )  const [inline]

Returns a constant reference to the value at index i.

Definition at line 75 of file matvec3D.h.

void vec3::perpVectors ( vec3 v1,
vec3 v2 
)

Returns two vectors that are perpendicular to this vector and each other.

Definition at line 61 of file matvec.cpp.

void vec3::set ( const SbVec3f &  v  )  [inline]

Sets the values in this vector with the values from the Inventor vector v.

Definition at line 553 of file matvec3D.h.

void vec3::set ( double  x,
double  y,
double  z 
) [inline]

Sets the 3 values in this vector to x, y, z.

Definition at line 87 of file matvec3D.h.

void vec3::set ( double  v[3]  )  [inline]

Sets the 3 values in this vector to the 3 values in the array v.

Definition at line 84 of file matvec3D.h.

void vec3::set ( const vec3 v  )  [inline]

Copies vector v.

Definition at line 81 of file matvec3D.h.

SbVec3f vec3::toSbVec3f (  )  const [inline]

Converts this vector into an Inventor vector and returns it.

Definition at line 576 of file matvec3D.h.

void vec3::toSbVec3f ( SbVec3f &  v  )  const [inline]

Converts the values of this vector into floats and stores them in the provided Inventor vector.

Definition at line 565 of file matvec3D.h.

double& vec3::x (  )  [inline]

Returns a reference to the x-coordinate of this vector.

Definition at line 118 of file matvec3D.h.

double vec3::x (  )  const [inline]

Returns the x-coordinate of this vector.

Definition at line 109 of file matvec3D.h.

double& vec3::y (  )  [inline]

Returns a reference to the y-coordinate of this vector.

Definition at line 121 of file matvec3D.h.

double vec3::y (  )  const [inline]

Returns the y-coordinate of this vector.

Definition at line 112 of file matvec3D.h.

double& vec3::z (  )  [inline]

Returns a reference to the z-coordinate of this vector.

Definition at line 124 of file matvec3D.h.

double vec3::z (  )  const [inline]

Returns the z-coordinate of this vector.

Definition at line 115 of file matvec3D.h.


Friends And Related Function Documentation

vec3 normalise ( vec3 const &  v  )  [friend]

Returns a new unit vector that is the normalized version of vector v.

Definition at line 779 of file matvec3D.h.

double operator% ( vec3 const &  v,
position const &  p 
) [friend]

Returns the dot product of vector v and position p.

Definition at line 720 of file matvec3D.h.

double operator% ( position const &  p,
vec3 const &  v 
) [friend]

Returns the dot product of vector v and position p.

Definition at line 713 of file matvec3D.h.

double operator% ( vec3 const &  v1,
vec3 const &  v2 
) [friend]

Returns the dot product of vectors v1 and v2.

Definition at line 585 of file matvec3D.h.

vec3 operator* ( vec3 const &  v1,
vec3 const &  v2 
) [friend]

Returns the cross product of vectors v1 and v2 ( v1 x v2 ).

Definition at line 739 of file matvec3D.h.

vec3 operator* ( vec3 const &  v,
transf const &  tr 
) [friend]

Returns a vector that is the result of rotating vector v using transform tr.

Definition at line 1328 of file matvec3D.h.

vec3 operator* ( mat3 const &  m,
vec3 const &  v 
) [friend]

Definition at line 727 of file matvec3D.h.

vec3 operator* ( vec3 const &  v,
double  s 
) [friend]

Returns a new vector that is the result of scaling this vector by s.

Definition at line 603 of file matvec3D.h.

vec3 operator* ( double  s,
vec3 const &  v 
) [friend]

Returns a new vector that is the result of scaling this vector by s.

Definition at line 594 of file matvec3D.h.

vec3 operator+ ( vec3 const &  v1,
vec3 const &  v2 
) [friend]

Returns the sum of vectors v1 and v2.

Definition at line 748 of file matvec3D.h.

vec3 operator- ( vec3 const &  v  )  [friend]

Returns a vector that is the negative of vector v. (unary minus)

Definition at line 764 of file matvec3D.h.

vec3 operator- ( vec3 const &  v1,
vec3 const &  v2 
) [friend]

Returns the difference between vectors v1 and v2.

Definition at line 756 of file matvec3D.h.

vec3 operator/ ( vec3 const &  v,
double  s 
) [friend]

Returns a new vector that is the result of scaling this vector by 1/s.

Definition at line 772 of file matvec3D.h.

std::ostream& operator<< ( std::ostream &  os,
const vec3 v 
) [friend]

Writes the values of vector v to a stream os in the format "[#, #, #]".

Definition at line 425 of file matvec.cpp.

vec3 operator> ( vec3 const &  v,
transf const &  tr 
) [friend]

Definition at line 1334 of file matvec3D.h.

std::istream& operator>> ( std::istream &  is,
vec3 v 
) [friend]

Reads the values of a vector v from stream is formatted as "[#, #, #]"

Definition at line 407 of file matvec.cpp.


Member Data Documentation

double vec3::vec[3] [private]

Storarge for the 3 vector coordinates.

Definition at line 56 of file matvec3D.h.

const vec3 vec3::X [static]

The vector [1,0,0].

Definition at line 155 of file matvec3D.h.

const vec3 vec3::Y [static]

The vector [0,1,0].

Definition at line 158 of file matvec3D.h.

const vec3 vec3::Z [static]

The vector [0,0,1].

Definition at line 161 of file matvec3D.h.

const vec3 vec3::ZERO [static]

The vector [0,0,0].

Definition at line 152 of file matvec3D.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


graspit
Author(s):
autogenerated on Wed Jan 25 11:00:27 2012