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

VECTOR Class Reference

#include <vector.h>

List of all members.

Public Methods

 VECTOR (float sx=0, float sy=0, float sz=0)
 ~VECTOR ()
float GetMagnitude ()
void Normalize ()
void Reset ()
void Set (float sx, float sy, float sz)
void CrossVector (VECTOR vect)
float DotProduct (VECTOR vect)
const bool nearlyEquals (const VECTOR &v, const SCALAR e) 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 ()
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

Public Attributes

float x
float y
float z

Friends

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


Constructor & Destructor Documentation

VECTOR::VECTOR float    sx = 0,
float    sy = 0,
float    sz = 0
 

Definition at line 5 of file vector.cpp.

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

00006 :
00007     x(sx),
00008     y(sy),
00009     z(sz)
00010 {
00011 }

VECTOR::~VECTOR  
 

Definition at line 13 of file vector.cpp.

00014 {
00015 }


Member Function Documentation

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

Definition at line 29 of file vector.h.

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

00030         {
00031             //Davis, Snider, "Introduction to Vector Analysis", p. 44
00032             return VECTOR( y*v.z - z*v.y, z*v.x - x*v.z, x*v.y - y*v.x );
00033         }

void VECTOR::CrossVector VECTOR    vect
 

Definition at line 31 of file vector.cpp.

References x, y, and z.

Referenced by CreateDecal(), and QUAT::MultQuat().

00032 {
00033       VECTOR temp = *this;
00034       x = vect.y * temp.z - vect.z * temp.y;
00035       y = vect.z * temp.x - vect.x * temp.z;
00036       z = vect.x * temp.y - vect.y * temp.x;
00037 }

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

Definition at line 36 of file vector.h.

References SCALAR, x, y, and z.

Referenced by DotProduct(), Spark::SetDefaults(), Bouncy::Update(), Roman::Update(), and Spark::Update().

00037         {
00038             return x*v.x + y*v.y + z*v.z;
00039         }

float VECTOR::DotProduct VECTOR    vect
 

Definition at line 24 of file vector.cpp.

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

Referenced by QUAT::MultQuat().

00025 {
00026       float dot;
00027       dot = vect.x * x + vect.y * y + vect.z * z;
00028       return dot;
00029 }

float VECTOR::GetMagnitude  
 

Definition at line 39 of file vector.cpp.

References x, y, and z.

Referenced by CreateLightmaps(), Normalize(), and UpdateBullets().

00040 {
00041     float magnitude = (float)sqrt(x * x + y * y + z * z);
00042     if (magnitude != 0.0f)
00043         return magnitude;
00044     else
00045         return 1.0;
00046 }

const SCALAR VECTOR::length   const [inline]
 

Definition at line 42 of file vector.h.

References SCALAR.

Referenced by normalize(), and unit().

00043         {
00044             return (SCALAR)sqrt( (double)this->dot(*this) );
00045         }

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

Definition at line 23 of file vector.h.

References SCALAR, x, y, and z.

00024         {
00025             return fabs(x-v.x)<e && fabs(y-v.y)<e && fabs(z-v.z)<e;
00026         }

void VECTOR::normalize   [inline]
 

Definition at line 54 of file vector.h.

References length().

Referenced by CheckForParticleCollision(), and Spark::SetDefaults().

00055         {
00056             (*this) /= length();
00057         }

void VECTOR::Normalize  
 

Definition at line 48 of file vector.cpp.

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

Referenced by CreateDecal(), CreateLargePortal(), CreateLightmaps(), DrawFire(), DrawHalo(), DrawImpactFlash(), Bouncy::Render(), Roman::Render(), and Spark::Render().

00049 {
00050     float magnitude = this->GetMagnitude();
00051     x /= magnitude;
00052     y /= magnitude;
00053     z /= magnitude;
00054 }

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

Definition at line 148 of file vector.h.

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

00149         {
00150             return VECTOR( x*s, y*s, z*s );
00151         }

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

Definition at line 117 of file vector.h.

References SCALAR, x, y, and z.

00118         {
00119             x*=s;
00120             y*=s;
00121             z*=s;
00122             return *this;
00123         }

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

Definition at line 78 of file vector.h.

00079         {
00080             return !(v == *this);
00081         }

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

Definition at line 136 of file vector.h.

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

00137         {
00138             return VECTOR(x + v.x, y + v.y, z + v.z);
00139         }

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

Definition at line 99 of file vector.h.

References x, y, and z.

00100         {
00101             x+=v.x;
00102             y+=v.y;
00103             z+=v.z;
00104             return *this;
00105         }

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

Definition at line 142 of file vector.h.

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

00143         {
00144             return VECTOR(x - v.x, y - v.y, z - v.z);
00145         }

const VECTOR VECTOR::operator-   const [inline]
 

Definition at line 84 of file vector.h.

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

00085         {
00086             return VECTOR( -x, -y, -z );
00087         }

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

Definition at line 108 of file vector.h.

References x, y, and z.

00109         {
00110             x-=v.x;
00111             y-=v.y;
00112             z-=v.z;
00113             return *this;
00114         }

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

Definition at line 160 of file vector.h.

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

00161         {
00162             s = 1/s;
00163             return VECTOR( s*x, s*y, s*z );
00164         }

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

Definition at line 126 of file vector.h.

References SCALAR, x, y, and z.

00127         {
00128             const SCALAR r = 1 / s;
00129             x *= r;
00130             y *= r;
00131             z *= r;
00132             return *this;
00133         }

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

Definition at line 90 of file vector.h.

References x, y, and z.

00091         {
00092             x = v.x;
00093             y = v.y;
00094             z = v.z;
00095             return *this;
00096         }

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

Definition at line 73 of file vector.h.

References x, y, and z.

00074         {
00075             return (v.x==x && v.y==y && v.z==z);
00076         }

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

Definition at line 67 of file vector.h.

References SCALAR, and x.

00068         {
00069             return *((&x) + i);
00070         }

void VECTOR::Reset  
 

Definition at line 17 of file vector.cpp.

References x, y, and z.

Referenced by OBJECT::Reset(), CAMERA::Reset(), and BULLET::Reset().

00018 {
00019     x = 0;
00020     y = 0;
00021     z = 0;
00022 }

void VECTOR::Set float    sx,
float    sy,
float    sz
[inline]
 

Definition at line 18 of file vector.h.

References x, y, and z.

Referenced by CreateBouncy(), CreateDecal(), CreateRomanCandle(), InitGL(), and LIGHT::Reset().

00018 {x = sx, y = sy, z = sz;}

const VECTOR VECTOR::unit   const [inline]
 

Definition at line 48 of file vector.h.

References length().

00049         {
00050             return (*this) / length();
00051         }


Friends And Related Function Documentation

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

Definition at line 154 of file vector.h.

00155         {
00156             return v * s;
00157         }


Member Data Documentation

float VECTOR::x
 

Definition at line 60 of file vector.h.

Referenced by AddSpline(), LIGHT::Apply(), CAMERA::Apply(), AxisAngleToMatrix(), QUAT::AxisAngleToQuat(), bspline(), bsplinepoint(), CalculatePVS(), CheckClipPlanes(), CheckForCollision(), CheckForParticleCollision(), CheckPointInSphere(), CheckPointInTriangle(), ClassifyInvertedPortal(), ClassifyPoint(), ClassifyPortal(), ClosestPointOnLine(), ClosestPointOnPolygon(), compute_point(), CreateDecal(), CreateLargePortal(), CreateLightmaps(), cross(), CrossVector(), CrossVector(), dot(), DotProduct(), DotProduct(), BULLET::Draw(), DrawFire(), DrawGLScene(), DrawHalo(), DrawImpactFlash(), DrawIntersectionSphere(), DrawMuzzleFlash(), DrawSplines(), FindCurrentLeaf(), FindVisibleLeaves(), GetEdgeIntersection(), GetEdgeVector(), GetMagnitude(), PORTAL::GetNormal(), POLYGON::GetNormal(), GetUnitVector(), OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::GetZUnit(), IntersectRaySphere(), InvertPortals(), IsZeroVector(), line_plane_collision(), LoadSplines(), MagnitudeVector(), MATRIX::MatrixFromAxisAngle(), OBJECT::MoveX(), OBJECT::MoveY(), OBJECT::MoveZ(), QUAT::MultQuat(), MultQuat(), nearlyEquals(), Normalize(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), operator[](), PointInFrustum(), Bouncy::Render(), Roman::Render(), Spark::Render(), RenderBSP(), Reset(), LIGHT::Reset(), Set(), Bouncy::SetDefaults(), Roman::SetDefaults(), Spark::SetDefaults(), SetLength(), SetStaticLights(), SphereInFrustum(), SplitPolygon(), SplitPortal(), TangentPlaneNormalOfEllipsoid(), Bouncy::Update(), Roman::Update(), Spark::Update(), UpdateBullets(), UpdateChannel(), UpdateListener(), and Wedge().

float VECTOR::y
 

Definition at line 61 of file vector.h.

Referenced by AddSpline(), LIGHT::Apply(), CAMERA::Apply(), AxisAngleToMatrix(), QUAT::AxisAngleToQuat(), bspline(), bsplinepoint(), CalculatePVS(), CheckClipPlanes(), CheckForCollision(), CheckForParticleCollision(), CheckPointInSphere(), CheckPointInTriangle(), ClassifyInvertedPortal(), ClassifyPoint(), ClassifyPortal(), ClosestPointOnLine(), ClosestPointOnPolygon(), compute_point(), CreateDecal(), CreateLargePortal(), CreateLightmaps(), cross(), CrossVector(), CrossVector(), dot(), DotProduct(), DotProduct(), BULLET::Draw(), DrawFire(), DrawGLScene(), DrawHalo(), DrawImpactFlash(), DrawIntersectionSphere(), DrawMuzzleFlash(), DrawSplines(), FindCurrentLeaf(), FindVisibleLeaves(), GetEdgeIntersection(), GetEdgeVector(), GetMagnitude(), PORTAL::GetNormal(), POLYGON::GetNormal(), GetUnitVector(), OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::GetZUnit(), IntersectRaySphere(), InvertPortals(), IsZeroVector(), line_plane_collision(), LoadSplines(), MagnitudeVector(), MATRIX::MatrixFromAxisAngle(), OBJECT::MoveX(), OBJECT::MoveY(), OBJECT::MoveZ(), QUAT::MultQuat(), MultQuat(), nearlyEquals(), Normalize(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), PointInFrustum(), Bouncy::Render(), Roman::Render(), Spark::Render(), RenderBSP(), Reset(), LIGHT::Reset(), Set(), Bouncy::SetDefaults(), Roman::SetDefaults(), Spark::SetDefaults(), SetLength(), SetStaticLights(), SphereInFrustum(), SplitPolygon(), SplitPortal(), TangentPlaneNormalOfEllipsoid(), Bouncy::Update(), Roman::Update(), Spark::Update(), UpdateBullets(), UpdateChannel(), UpdateListener(), and Wedge().

float VECTOR::z
 

Definition at line 62 of file vector.h.

Referenced by AddSpline(), LIGHT::Apply(), CAMERA::Apply(), AxisAngleToMatrix(), QUAT::AxisAngleToQuat(), bspline(), bsplinepoint(), CalculatePVS(), CheckClipPlanes(), CheckForCollision(), CheckForParticleCollision(), CheckPointInSphere(), CheckPointInTriangle(), ClassifyInvertedPortal(), ClassifyPoint(), ClassifyPortal(), ClosestPointOnLine(), ClosestPointOnPolygon(), compute_point(), CreateDecal(), CreateLargePortal(), CreateLightmaps(), cross(), CrossVector(), CrossVector(), dot(), DotProduct(), DotProduct(), BULLET::Draw(), DrawFire(), DrawGLScene(), DrawHalo(), DrawImpactFlash(), DrawIntersectionSphere(), DrawMuzzleFlash(), DrawSplines(), FindCurrentLeaf(), FindVisibleLeaves(), GetEdgeIntersection(), GetEdgeVector(), GetMagnitude(), PORTAL::GetNormal(), POLYGON::GetNormal(), GetUnitVector(), OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::GetZUnit(), IntersectRaySphere(), InvertPortals(), IsZeroVector(), line_plane_collision(), LoadSplines(), MagnitudeVector(), MATRIX::MatrixFromAxisAngle(), OBJECT::MoveX(), OBJECT::MoveY(), OBJECT::MoveZ(), QUAT::MultQuat(), MultQuat(), nearlyEquals(), Normalize(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), PointInFrustum(), Bouncy::Render(), Roman::Render(), Spark::Render(), RenderBSP(), Reset(), LIGHT::Reset(), Set(), Bouncy::SetDefaults(), Roman::SetDefaults(), Spark::SetDefaults(), SetLength(), SetStaticLights(), SphereInFrustum(), SplitPolygon(), SplitPortal(), TangentPlaneNormalOfEllipsoid(), Bouncy::Update(), Roman::Update(), Spark::Update(), UpdateBullets(), UpdateChannel(), UpdateListener(), and Wedge().


The documentation for this class was generated from the following files:
Generated on Fri Dec 23 05:20:00 2005 for Particles by doxygen1.2.15