NASA - Jet Propulsion Laboratory
    + View the NASA Portal
Search JPL
Jet Propulsion Laboratory Home Earth Solar System Stars & Galaxies Technology
Introduction Background Software Links

vec3 Class Reference
[3D vectors]

#include <vec3.h>

List of all members.

Public Member Functions

 vec3 ()
 vec3 (double xc, double yc, double zc)
void set_z_phi (double z_, double phi)
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::set_z_phi ( double  z_,
double  phi 
) [inline]

Creates a unit vector from a z coordinate and an azimuthal angle.

Definition at line 58 of file vec3.h.

void vec3::Normalize (  )  [inline]

Normalizes the vector to length 1.

Definition at line 68 of file vec3.h.

double vec3::Length (  )  const [inline]

Returns the length of the vector.

Definition at line 76 of file vec3.h.

double vec3::SquaredLength (  )  const [inline]

Returns the squared length of the vector.

Definition at line 80 of file vec3.h.

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

Returns the vector with the signs of all coordinates flipped.

Definition at line 83 of file vec3.h.

void vec3::Flip (  )  [inline]

Flips the signs of all coordinates.

Definition at line 86 of file vec3.h.

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

Subtracts vec from the vector.

Definition at line 89 of file vec3.h.

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

Adds vec to the vector.

Definition at line 92 of file vec3.h.

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

Returns the vector scaled by fact.

Definition at line 95 of file vec3.h.

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

Returns the vector scaled by 1/fact.

Definition at line 98 of file vec3.h.

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

Scales the vector by fact.

Definition at line 101 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 Jun 18 16:12:29 2010 for LevelS C++ support library
Privacy / Copyright
FIRST GOV Contact: NASA Home Page Site Manager:
Webmaster:

CL 03-2650