pVec Class Reference

#include <pVec.h>

List of all members.

Public Member Functions

 pVec (float ax, float ay, float az)
 pVec (float a)
 pVec ()
const float & x () const
const float & y () const
const float & z () const
float & x ()
float & y ()
float & z ()
float length () const
float length2 () const
float normalize ()
float operator * (const pVec &a) const
pVec operator * (const float s) const
pVec operator/ (const float s) const
pVec operator+ (const pVec &a) const
pVec operator- (const pVec &a) const
bool operator== (const pVec &a) const
pVec operator- ()
pVecoperator+= (const pVec &a)
pVecoperator-= (const pVec &a)
pVecoperator *= (const float a)
pVecoperator/= (const float a)
pVecoperator= (const pVec &a)

Private Attributes

float vx
float vy
float vz

Friends

pVec Abs (const pVec &a)
pVec CompMult (const pVec &a, const pVec &b)
pVec Cross (const pVec &a, const pVec &b)
std::ostream & operator<< (std::ostream &os, const pVec &v)


Detailed Description

Definition at line 71 of file pVec.h.


Constructor & Destructor Documentation

pVec::pVec ( float  ax,
float  ay,
float  az 
) [inline]

Definition at line 76 of file pVec.h.

00076 : vx(ax), vy(ay), vz(az) {}

pVec::pVec ( float  a  )  [inline]

Definition at line 78 of file pVec.h.

00078 : vx(a), vy(a), vz(a) {}

pVec::pVec (  )  [inline]

Definition at line 80 of file pVec.h.

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

00080 {}

Here is the caller graph for this function:


Member Function Documentation

const float& pVec::x (  )  const [inline]

Definition at line 82 of file pVec.h.

References vx.

Referenced by NewBasis(), operator *(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), PDBox::PDBox(), pGetParticlePointer(), pGetParticles(), pVertex(), and PDBox::Within().

00082 { return vx; }

Here is the caller graph for this function:

const float& pVec::y (  )  const [inline]

Definition at line 83 of file pVec.h.

References vy.

Referenced by NewBasis(), operator *(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), PDBox::PDBox(), pGetParticles(), and PDBox::Within().

00083 { return vy; }

Here is the caller graph for this function:

const float& pVec::z (  )  const [inline]

Definition at line 84 of file pVec.h.

References vz.

Referenced by NewBasis(), operator *(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), PDBox::PDBox(), pGetParticles(), and PDBox::Within().

00084 { return vz; }

Here is the caller graph for this function:

float& pVec::x (  )  [inline]

Definition at line 86 of file pVec.h.

References vx.

00086 { return vx; }

float& pVec::y (  )  [inline]

Definition at line 87 of file pVec.h.

References vy.

00087 { return vy; }

float& pVec::z (  )  [inline]

Definition at line 88 of file pVec.h.

References vz.

00088 { return vz; }

float pVec::length (  )  const [inline]

Definition at line 90 of file pVec.h.

References sqrtf(), vx, vy, and vz.

Referenced by PABounce::Exec(), PAAvoid::Exec(), PDRectangle::PDRectangle(), and PDTriangle::PDTriangle().

00091     {
00092         return sqrtf(vx*vx+vy*vy+vz*vz);
00093     }

Here is the call graph for this function:

Here is the caller graph for this function:

float pVec::length2 (  )  const [inline]

Definition at line 95 of file pVec.h.

References vx, vy, and vz.

Referenced by PABounce::Exec(), PAAvoid::Exec(), PDSphere::Generate(), PDCone::PDCone(), PDCylinder::PDCylinder(), PDBlob::Within(), PDSphere::Within(), PDCone::Within(), and PDCylinder::Within().

00096     {
00097         return (vx*vx+vy*vy+vz*vz);
00098     }

Here is the caller graph for this function:

float pVec::normalize (  )  [inline]

Definition at line 100 of file pVec.h.

References sqrtf(), vx, vy, and vz.

Referenced by PABounce::Exec(), PAAvoid::Exec(), PDSphere::Generate(), PDCone::PDCone(), PDCylinder::PDCylinder(), PDDisc::PDDisc(), PDPlane::PDPlane(), PDRectangle::PDRectangle(), PDTriangle::PDTriangle(), and pOrbitLine().

00101     {
00102         float onel = 1.0f / sqrtf(vx*vx+vy*vy+vz*vz);
00103         vx *= onel;
00104         vy *= onel;
00105         vz *= onel;
00106 
00107         return onel;
00108     }

Here is the call graph for this function:

Here is the caller graph for this function:

float pVec::operator * ( const pVec a  )  const [inline]

Definition at line 111 of file pVec.h.

References vx, vy, vz, x(), y(), and z().

00112     {
00113         return vx*a.x() + vy*a.y() + vz*a.z();
00114     }

Here is the call graph for this function:

pVec pVec::operator * ( const float  s  )  const [inline]

Definition at line 117 of file pVec.h.

References pVec(), vx, vy, and vz.

00118     {
00119         return pVec(vx*s, vy*s, vz*s);
00120     }

Here is the call graph for this function:

pVec pVec::operator/ ( const float  s  )  const [inline]

Definition at line 122 of file pVec.h.

References pVec(), vx, vy, and vz.

00123     {
00124         float invs = 1.0f / s;
00125         return pVec(vx*invs, vy*invs, vz*invs);
00126     }

Here is the call graph for this function:

pVec pVec::operator+ ( const pVec a  )  const [inline]

Definition at line 128 of file pVec.h.

References pVec(), vx, vy, vz, x(), y(), and z().

00129     {
00130         return pVec(vx+a.x(), vy+a.y(), vz+a.z());
00131     }

Here is the call graph for this function:

pVec pVec::operator- ( const pVec a  )  const [inline]

Definition at line 133 of file pVec.h.

References pVec(), vx, vy, vz, x(), y(), and z().

00134     {
00135         return pVec(vx-a.x(), vy-a.y(), vz-a.z());
00136     }

Here is the call graph for this function:

bool pVec::operator== ( const pVec a  )  const [inline]

Definition at line 138 of file pVec.h.

References vx, vy, vz, x(), y(), and z().

00139     {
00140         return vx==a.x() && vy==a.y() && vz==a.z();
00141     }

Here is the call graph for this function:

pVec pVec::operator- (  )  [inline]

Definition at line 143 of file pVec.h.

References vx, vy, and vz.

00144     {
00145         vx = -vx;
00146         vy = -vy;
00147         vz = -vz;
00148         return *this;
00149     }

pVec& pVec::operator+= ( const pVec a  )  [inline]

Definition at line 151 of file pVec.h.

References vx, vy, vz, x(), y(), and z().

00152     {
00153         vx += a.x();
00154         vy += a.y();
00155         vz += a.z();
00156         return *this;
00157     }

Here is the call graph for this function:

pVec& pVec::operator-= ( const pVec a  )  [inline]

Definition at line 159 of file pVec.h.

References vx, vy, vz, x(), y(), and z().

00160     {
00161         vx -= a.x();
00162         vy -= a.y();
00163         vz -= a.z();
00164         return *this;
00165     }

Here is the call graph for this function:

pVec& pVec::operator *= ( const float  a  )  [inline]

Definition at line 167 of file pVec.h.

References vx, vy, and vz.

00168     {
00169         vx *= a;
00170         vy *= a;
00171         vz *= a;
00172         return *this;
00173     }

pVec& pVec::operator/= ( const float  a  )  [inline]

Definition at line 175 of file pVec.h.

References b, vx, vy, and vz.

00176     {
00177         float b = 1.0f / a;
00178         vx *= b;
00179         vy *= b;
00180         vz *= b;
00181         return *this;
00182     }

pVec& pVec::operator= ( const pVec a  )  [inline]

Definition at line 184 of file pVec.h.

References vx, vy, vz, x(), y(), and z().

00185     {
00186         vx = a.x();
00187         vy = a.y();
00188         vz = a.z();
00189         return *this;
00190     }

Here is the call graph for this function:


Friends And Related Function Documentation

pVec Abs ( const pVec a  )  [friend]

Definition at line 193 of file pVec.h.

00194     {
00195         return pVec(fabs(a.x()), fabs(a.y()), fabs(a.z()));
00196     }

pVec CompMult ( const pVec a,
const pVec b 
) [friend]

Definition at line 199 of file pVec.h.

00200     {
00201         return pVec(b.x()*a.x(), b.y()*a.y(), b.z()*a.z());
00202     }

pVec Cross ( const pVec a,
const pVec b 
) [friend]

Definition at line 204 of file pVec.h.

00205     {
00206         return pVec(
00207                    a.y()*b.z()-a.z()*b.y(),
00208                    a.z()*b.x()-a.x()*b.z(),
00209                    a.x()*b.y()-a.y()*b.x());
00210     }

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

Definition at line 212 of file pVec.h.

00213     {
00214         os << &v << '[' << v.x() << ", " << v.y() << ", " << v.z() << ']';
00215 
00216         return os;
00217     }


Member Data Documentation

float pVec::vx [private]

Definition at line 73 of file pVec.h.

Referenced by length(), length2(), normalize(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), and x().

float pVec::vy [private]

Definition at line 73 of file pVec.h.

Referenced by length(), length2(), normalize(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), and y().

float pVec::vz [private]

Definition at line 73 of file pVec.h.

Referenced by length(), length2(), normalize(), operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator=(), operator==(), and z().


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:52:11 2008 for Armagetron Advanced by  doxygen 1.5.4