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

VECTOR Class Reference

#include <vector.h>

List of all members.

Public Methods

 VECTOR ()
 VECTOR (const SCALAR &a, const SCALAR &b, const SCALAR &c)
SCALARoperator[] (const long i)
const bool operator== (const VECTOR &v) const
const bool operator!= (const VECTOR &v) const
const VECTOR operator- () const
const VECTOR & operator= (const VECTOR &v)
const VECTOR & operator+= (const VECTOR &v)
const VECTOR & operator-= (const VECTOR &v)
const VECTOR & operator *= (const SCALAR &s)
const VECTOR & operator/= (const SCALAR &s)
const VECTOR operator+ (const VECTOR &v) const
const VECTOR operator- (const VECTOR &v) const
const VECTOR operator * (const SCALAR &s) const
const VECTOR operator/ (SCALAR s) const
const VECTOR cross (const VECTOR &v) const
const SCALAR dot (const VECTOR &v) const
const SCALAR length () const
const VECTOR unit () const
void normalize ()
const bool nearlyEquals (const VECTOR &v, const SCALAR e) const

Public Attributes

SCALAR x
SCALAR y
SCALAR z

Friends

const VECTOR operator * (const SCALAR &s, const VECTOR &v)


Constructor & Destructor Documentation

VECTOR::VECTOR   [inline]
 

Definition at line 16 of file vector.h.

Referenced by cross(), operator *(), operator+(), operator-(), and operator/().

00016 : x(0), y(0), z(0) {}

VECTOR::VECTOR const SCALAR   a,
const SCALAR   b,
const SCALAR   c
[inline]
 

Definition at line 18 of file vector.h.

00018 : x(a), y(b), z(c) {}


Member Function Documentation

const VECTOR VECTOR::cross const VECTOR &    v const [inline]
 

Definition at line 135 of file vector.h.

References VECTOR(), x, y, and z.

Referenced by Matrix4x4::rotation().

00136         {
00137                 //Davis, Snider, "Introduction to Vector Analysis", p. 44
00138                 return VECTOR( y*v.z - z*v.y, z*v.x - x*v.z, x*v.y - y*v.x );
00139         }

const SCALAR VECTOR::dot const VECTOR &    v const [inline]
 

Definition at line 143 of file vector.h.

References SCALAR, x, y, and z.

Referenced by Plane::Distance(), Plane::Intersection(), Trilinear::Lighting(), Ray::Lighting(), Plane::Plane(), and Matrix4x4::rotation().

00144         {
00145                 return x*v.x + y*v.y + z*v.z;
00146         }

const SCALAR VECTOR::length   const [inline]
 

Definition at line 150 of file vector.h.

References SCALAR.

Referenced by XRayTRI::CastNext(), XRayNN::CastNext(), MaxIntensityTRI::CastNext(), MaxIntensityNN::CastNext(), FirstHitTRI::CastNext(), FirstHitNN::CastNext(), Trilinear::CastNext(), Ray::CastNext(), Trilinear::Lighting(), Ray::Lighting(), normalize(), and unit().

00151         {
00152                 return (SCALAR)sqrt( (double)this->dot(*this) );
00153         }

const bool VECTOR::nearlyEquals const VECTOR &    v,
const SCALAR    e
const [inline]
 

Definition at line 171 of file vector.h.

References x, y, and z.

00172         {
00173                 return fabs(x-v.x)<e && fabs(y-v.y)<e && fabs(z-v.z)<e;
00174         }

void VECTOR::normalize   [inline]
 

Definition at line 164 of file vector.h.

References length().

Referenced by Trilinear::Lighting(), and Ray::Lighting().

00165         {
00166                 (*this) /= length();
00167         }

const VECTOR VECTOR::operator * const SCALAR   s const [inline]
 

Definition at line 113 of file vector.h.

References VECTOR().

00114         {
00115                 return VECTOR( x*s, y*s, z*s );
00116         }

const VECTOR& VECTOR::operator *= const SCALAR   s [inline]
 

Definition at line 79 of file vector.h.

00080         {
00081                 x*=s;
00082                 y*=s;
00083                 z*=s;
00084                 return *this;
00085         }

const bool VECTOR::operator!= const VECTOR &    v const [inline]
 

Definition at line 36 of file vector.h.

00037         {
00038                 return !(v == *this);
00039         }

const VECTOR VECTOR::operator+ const VECTOR &    v const [inline]
 

Definition at line 99 of file vector.h.

References VECTOR(), x, y, and z.

00100         {
00101                 return VECTOR(x + v.x, y + v.y, z + v.z);
00102         }

const VECTOR& VECTOR::operator+= const VECTOR &    v [inline]
 

Definition at line 60 of file vector.h.

References x, y, and z.

00061         {
00062                 x+=v.x;
00063                 y+=v.y;
00064                 z+=v.z;
00065                 return *this;
00066         } 

const VECTOR VECTOR::operator- const VECTOR &    v const [inline]
 

Definition at line 106 of file vector.h.

References VECTOR(), x, y, and z.

00107         {
00108                 return VECTOR(x - v.x, y - v.y, z - v.z);
00109         }

const VECTOR VECTOR::operator-   const [inline]
 

Definition at line 43 of file vector.h.

References VECTOR().

00044         {
00045                 return VECTOR( -x, -y, -z );
00046         }

const VECTOR& VECTOR::operator-= const VECTOR &    v [inline]
 

Definition at line 70 of file vector.h.

References x, y, and z.

00071         {
00072                 x-=v.x;
00073                 y-=v.y;
00074                 z-=v.z;
00075                 return *this;
00076         } 

const VECTOR VECTOR::operator/ SCALAR    s const [inline]
 

Definition at line 127 of file vector.h.

References VECTOR().

00128         {
00129                 s = 1/s;
00130                 return VECTOR( s*x, s*y, s*z );
00131         }

const VECTOR& VECTOR::operator/= const SCALAR   s [inline]
 

Definition at line 88 of file vector.h.

References SCALAR.

00089         {
00090                 const SCALAR r = 1 / s;
00091                 x *= r;
00092                 y *= r;
00093                 z *= r;
00094                 return *this;
00095         }

const VECTOR& VECTOR::operator= const VECTOR &    v [inline]
 

Definition at line 50 of file vector.h.

References x, y, and z.

00051         {
00052                 x = v.x;
00053                 y = v.y;
00054                 z = v.z;
00055                 return *this;
00056         }

const bool VECTOR::operator== const VECTOR &    v const [inline]
 

Definition at line 31 of file vector.h.

References x, y, and z.

00032         {
00033                 return (v.x==x && v.y==y && v.z==z);
00034         }

SCALAR& VECTOR::operator[] const long    i [inline]
 

Definition at line 24 of file vector.h.

References SCALAR.

00025         {
00026                 return *((&x) + i);
00027         }

const VECTOR VECTOR::unit   const [inline]
 

Definition at line 157 of file vector.h.

References length().

00158         {
00159         return (*this) / length();
00160         }


Friends And Related Function Documentation

const VECTOR operator * const SCALAR   s,
const VECTOR &    v
[friend]
 

Definition at line 120 of file vector.h.

00121         {
00122                 return v * s;
00123         }


Member Data Documentation

SCALAR VECTOR::x
 

Definition at line 14 of file vector.h.

Referenced by Trilinear::CalcAlphaTrilinear(), Trilinear::CalcColorTrilinear(), Trilinear::CalcGradTrilinear(), XRayTRI::CastNext(), XRayNN::CastNext(), MaxIntensityTRI::CastNext(), MaxIntensityNN::CastNext(), FirstHitTRI::CastNext(), FirstHitNN::CastNext(), Trilinear::CastNext(), Ray::CastNext(), cross(), dot(), FirstHitTRI::GetDensity(), Ray::Lighting(), nearlyEquals(), Matrix4x4::operator *(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), Raycaster::Raycast(), Matrix4x4::rotation(), and Matrix4x4::translate().

SCALAR VECTOR::y
 

Definition at line 14 of file vector.h.

Referenced by Trilinear::CalcAlphaTrilinear(), Trilinear::CalcColorTrilinear(), Trilinear::CalcGradTrilinear(), XRayTRI::CastNext(), XRayNN::CastNext(), MaxIntensityTRI::CastNext(), MaxIntensityNN::CastNext(), FirstHitTRI::CastNext(), FirstHitNN::CastNext(), Trilinear::CastNext(), Ray::CastNext(), cross(), dot(), FirstHitTRI::GetDensity(), Ray::Lighting(), nearlyEquals(), Matrix4x4::operator *(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), Raycaster::Raycast(), Matrix4x4::rotation(), and Matrix4x4::translate().

SCALAR VECTOR::z
 

Definition at line 14 of file vector.h.

Referenced by Trilinear::CalcAlphaTrilinear(), Trilinear::CalcColorTrilinear(), Trilinear::CalcGradTrilinear(), XRayTRI::CastNext(), XRayNN::CastNext(), MaxIntensityTRI::CastNext(), MaxIntensityNN::CastNext(), FirstHitTRI::CastNext(), FirstHitNN::CastNext(), Trilinear::CastNext(), Ray::CastNext(), cross(), dot(), FirstHitTRI::GetDensity(), Ray::Lighting(), nearlyEquals(), Matrix4x4::operator *(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), Raycaster::Raycast(), Matrix4x4::rotation(), and Matrix4x4::translate().


The documentation for this class was generated from the following file:
Generated on Thu Jan 30 21:35:44 2003 for 3DVis by doxygen1.3-rc2