Main Page | Modules | Alphabetical List | Class List | File List | Class Members | File Members

vec3 Class Reference
[3D vectors]

#include <vec3.h>

List of all members.

Public Member Functions

 vec3 ()
 vec3 (double xc, double yc, double zc)
void Normalize ()
double Length () const
double SquaredLength () const
const vec3 operator- () const
void Flip ()
const vec3 operator- (const vec3 &vec) const
const vec3 operator+ (const vec3 &vec) const
const vec3 operator * (double fact) const
const vec3 operator/ (double fact) const
vec3operator *= (double fact)

Public Attributes

double x
double y
double z

Related Functions

(Note that these are not member functions.)

double dotprod (const vec3 &v1, const vec3 &v2)
vec3 crossprod (const vec3 &a, const vec3 &b)
std::ostream & operator<< (std::ostream &os, const vec3 &v)


Detailed Description

Class representing a 3D cartesian vector.

Definition at line 44 of file vec3.h.


Constructor & Destructor Documentation

vec3::vec3  )  [inline]
 

Default constructor. Does not initialize x, y, and z.

Definition at line 52 of file vec3.h.

vec3::vec3 double  xc,
double  yc,
double  zc
[inline]
 

Creates a vector with the coordinates xc, yc, and zc.

Definition at line 54 of file vec3.h.


Member Function Documentation

void vec3::Normalize  )  [inline]
 

Normalizes the vector to length 1.

Definition at line 58 of file vec3.h.

double vec3::Length  )  const [inline]
 

Returns the length of the vector.

Definition at line 66 of file vec3.h.

double vec3::SquaredLength  )  const [inline]
 

Returns the squared length of the vector.

Definition at line 70 of file vec3.h.

const vec3 vec3::operator-  )  const [inline]
 

Returns the vector with the signs of all coordinates flipped.

Definition at line 73 of file vec3.h.

void vec3::Flip  )  [inline]
 

Flips the signs of all coordinates.

Definition at line 76 of file vec3.h.

const vec3 vec3::operator- const vec3 vec  )  const [inline]
 

Subtracts vec from the vector.

Definition at line 79 of file vec3.h.

const vec3 vec3::operator+ const vec3 vec  )  const [inline]
 

Adds vec to the vector.

Definition at line 82 of file vec3.h.

const vec3 vec3::operator * double  fact  )  const [inline]
 

Returns the vector scaled by fact.

Definition at line 85 of file vec3.h.

const vec3 vec3::operator/ double  fact  )  const [inline]
 

Returns the vector scaled by 1/fact.

Definition at line 88 of file vec3.h.

vec3& vec3::operator *= double  fact  )  [inline]
 

Scales the vector by fact.

Definition at line 91 of file vec3.h.


Member Data Documentation

double vec3::x
 

x-coordinate

Definition at line 47 of file vec3.h.

double vec3::y
 

y-coordinate

Definition at line 47 of file vec3.h.

double vec3::z
 

z-coordinate

Definition at line 47 of file vec3.h.


The documentation for this class was generated from the following file:
Generated on Fri Jul 8 09:37:14 2005 for LevelS C++ support library