Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

vec4_t Class Reference

#include <math_vector.h>

Inheritance diagram for vec4_t:

Inheritance graph
[legend]
Collaboration diagram for vec4_t:

Collaboration graph
[legend]

Public Member Functions

idVec3_tCross (const idVec3_t &a, const idVec3_t &b)
idVec3_t Cross (const idVec3_t &a) const
idVec3_tCross (const idVec3_t &a, const idVec3_t &b)
idVec3_t Cross (const idVec3_t &a) const
float Length (void) const
float Length (void) const
float Normalize (void)
float Normalize (void)
idVec3_t operator * (const float a) const
float operator * (const idVec3_t &a) const
idVec3_t operator * (const float a) const
float operator * (const idVec3_t &a) const
idVec3_toperator *= (const float a)
idVec3_toperator *= (const float a)
 operator float * ()
 operator float * ()
int operator!= (const idVec3_t &a) const
int operator!= (const idVec3_t &a) const
idVec3_t operator+ (const idVec3_t &a) const
idVec3_t operator+ (const idVec3_t &a) const
idVec3_toperator+= (const idVec3_t &a)
idVec3_toperator+= (const idVec3_t &a)
idVec3_t operator- (const idVec3_t &a) const
idVec3_t operator- () const
idVec3_t operator- (const idVec3_t &a) const
idVec3_t operator- () const
idVec3_toperator-= (const idVec3_t &a)
idVec3_toperator-= (const idVec3_t &a)
int operator== (const idVec3_t &a) const
int operator== (const idVec3_t &a) const
float & operator[] (int index)
float operator[] (int index) const
float & operator[] (int index)
float operator[] (int index) const
void set (const float x, const float y, const float z)
void set (const float x, const float y, const float z)
void Snap (void)
void Snap (void)
void SnapTowards (const idVec3_t &to)
void SnapTowards (const idVec3_t &to)
char * string (void)
char * string (void)
angles_t toAngles (void)
angles_t toAngles (void)
float toPitch (void)
float toPitch (void)
float toYaw (void)
float toYaw (void)
 vec4_t (float x, float y, float z, float dist)
 vec4_t ()
 vec4_t (float x, float y, float z, float dist)
 vec4_t ()
void Zero (void)
void Zero (void)
 ~vec4_t ()
 ~vec4_t ()

Data Fields

float dist
float x
float y
float z

Friends

idVec3_t LerpVector (const idVec3_t &w1, const idVec3_t &w2, const float t)
idVec3_t LerpVector (const idVec3_t &w1, const idVec3_t &w2, const float t)
idVec3_t operator * (float a, idVec3_t b)
idVec3_t operator * (float a, idVec3_t b)

Constructor & Destructor Documentation

ID_INLINE vec4_t  ) 
 

Definition at line 540 of file math_vector.h.

References ID_INLINE.

00540 {}

~vec4_t  )  [inline]
 

Definition at line 533 of file math_vector.h.

00533 {};

ID_INLINE vec4_t float  x,
float  y,
float  z,
float  dist
 

Definition at line 541 of file math_vector.h.

References ID_INLINE, x, y, and z.

00541                                                                 {
00542     this->x = x;
00543     this->y = y;
00544     this->z = z;
00545     this->dist = dist;
00546 }

vec4_t  ) 
 

~vec4_t  )  [inline]
 

Definition at line 531 of file math_vector.h.

00531 {};

vec4_t float  x,
float  y,
float  z,
float  dist
 


Member Function Documentation

idVec3_t& Cross const idVec3_t a,
const idVec3_t b
[inherited]
 

idVec3_t Cross const idVec3_t a  )  const [inherited]
 

ID_INLINE idVec3_t & Cross const idVec3_t a,
const idVec3_t b
[inherited]
 

Definition at line 304 of file math_vector.h.

References a, b, ID_INLINE, idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00304                                                                           {
00305     x = a.y * b.z - a.z * b.y;
00306     y = a.z * b.x - a.x * b.z;
00307     z = a.x * b.y - a.y * b.x;
00308 
00309     return *this;
00310 }

ID_INLINE idVec3_t Cross const idVec3_t a  )  const [inherited]
 

Definition at line 300 of file math_vector.h.

References a, ID_INLINE, idVec3_t::idVec3_t(), x, idVec3_t::x, idVec3_t::y, z, and idVec3_t::z.

Referenced by mat3_t::OrthoNormalize().

00300                                                             {
00301     return idVec3_t( y * a.z - z * a.y, z * a.x - x * a.z, x * a.y - y * a.x );
00302 }

Here is the call graph for this function:

float Length void   )  const [inherited]
 

ID_INLINE float Length void   )  const [inherited]
 

Definition at line 312 of file math_vector.h.

References ID_INLINE, idSqrt(), length(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

Referenced by idInterpolatedPosition::getPosition(), idSplineList::initPosition(), idVec3_t::Normalize(), idPointListInterface::selectPointByRay(), idInterpolatedPosition::start(), and idSplineList::totalDistance().

00312                                              {
00313     float length;
00314     
00315     length = x * x + y * y + z * z;
00316     return ( float )idSqrt( length );
00317 }

Here is the call graph for this function:

float Normalize void   )  [inherited]
 

ID_INLINE float Normalize void   )  [inherited]
 

Definition at line 319 of file math_vector.h.

References ID_INLINE, idVec3_t::Length(), length(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

Referenced by idCameraDef::getCameraInfo(), and mat3_t::OrthoNormalize().

00319                                           {
00320     float length;
00321     float ilength;
00322 
00323     length = this->Length();
00324     if ( length ) {
00325         ilength = 1.0f / length;
00326         x *= ilength;
00327         y *= ilength;
00328         z *= ilength;
00329     }
00330         
00331     return length;
00332 }

Here is the call graph for this function:

idVec3_t operator * const float  a  )  const [inherited]
 

float operator * const idVec3_t a  )  const [inherited]
 

ID_INLINE idVec3_t operator * const float  a  )  const [inherited]
 

Definition at line 232 of file math_vector.h.

References a, ID_INLINE, idVec3_t::idVec3_t(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00232                                                             {
00233     return idVec3_t( x * a, y * a, z * a );
00234 }

Here is the call graph for this function:

ID_INLINE float operator * const idVec3_t a  )  const [inherited]
 

Definition at line 228 of file math_vector.h.

References a, ID_INLINE, idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00228                                                              {
00229     return x * a.x + y * a.y + z * a.z;
00230 }

idVec3_t& operator *= const float  a  )  [inherited]
 

ID_INLINE idVec3_t & operator *= const float  a  )  [inherited]
 

Definition at line 260 of file math_vector.h.

References ID_INLINE, idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00260                                                         {
00261     x *= a;
00262     y *= a;
00263     z *= a;
00264 
00265     return *this;
00266 }

operator float *  )  [inherited]
 

ID_INLINE operator float *  )  [inherited]
 

Definition at line 202 of file math_vector.h.

References ID_INLINE.

00202                                            {
00203     return &x;
00204 }

int operator!= const idVec3_t a  )  const [inherited]
 

ID_INLINE int operator!= const idVec3_t a  )  const [inherited]
 

Definition at line 284 of file math_vector.h.

References a, ID_INLINE, Q_fabs(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00284                                                             {
00285     if ( Q_fabs( x - a.x ) > EQUAL_EPSILON ) {
00286         return true;
00287     }
00288             
00289     if ( Q_fabs( y - a.y ) > EQUAL_EPSILON ) {
00290         return true;
00291     }
00292 
00293     if ( Q_fabs( z - a.z ) > EQUAL_EPSILON ) {
00294         return true;
00295     }
00296 
00297     return false;
00298 }

Here is the call graph for this function:

idVec3_t operator+ const idVec3_t a  )  const [inherited]
 

ID_INLINE idVec3_t operator+ const idVec3_t a  )  const [inherited]
 

Definition at line 240 of file math_vector.h.

References a, ID_INLINE, idVec3_t::idVec3_t(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00240                                                                 {
00241     return idVec3_t( x + a.x, y + a.y, z + a.z );
00242 }

Here is the call graph for this function:

idVec3_t& operator+= const idVec3_t a  )  [inherited]
 

ID_INLINE idVec3_t & operator+= const idVec3_t a  )  [inherited]
 

Definition at line 244 of file math_vector.h.

References a, ID_INLINE, idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00244                                                             {
00245     x += a.x;
00246     y += a.y;
00247     z += a.z;
00248 
00249     return *this;
00250 }

idVec3_t operator- const idVec3_t a  )  const [inherited]
 

idVec3_t operator-  )  const [inherited]
 

ID_INLINE idVec3_t operator- const idVec3_t a  )  const [inherited]
 

Definition at line 224 of file math_vector.h.

References a, ID_INLINE, idVec3_t::idVec3_t(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00224                                                                 {
00225     return idVec3_t( x - a.x, y - a.y, z - a.z );
00226 }

Here is the call graph for this function:

ID_INLINE idVec3_t operator-  )  const [inherited]
 

Definition at line 206 of file math_vector.h.

References ID_INLINE, idVec3_t::idVec3_t(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00206                                              {
00207     return idVec3_t( -x, -y, -z );
00208 }

Here is the call graph for this function:

idVec3_t& operator-= const idVec3_t a  )  [inherited]
 

ID_INLINE idVec3_t & operator-= const idVec3_t a  )  [inherited]
 

Definition at line 252 of file math_vector.h.

References a, ID_INLINE, idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00252                                                             {
00253     x -= a.x;
00254     y -= a.y;
00255     z -= a.z;
00256 
00257     return *this;
00258 }

int operator== const idVec3_t a  )  const [inherited]
 

ID_INLINE int operator== const idVec3_t a  )  const [inherited]
 

Definition at line 268 of file math_vector.h.

References a, ID_INLINE, Q_fabs(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00268                                                             {
00269     if ( Q_fabs( x - a.x ) > EQUAL_EPSILON ) {
00270         return false;
00271     }
00272             
00273     if ( Q_fabs( y - a.y ) > EQUAL_EPSILON ) {
00274         return false;
00275     }
00276 
00277     if ( Q_fabs( z - a.z ) > EQUAL_EPSILON ) {
00278         return false;
00279     }
00280 
00281     return true;
00282 }

Here is the call graph for this function:

float& operator[] int  index  ) 
 

Reimplemented from idVec3_t.

float operator[] int  index  )  const
 

Reimplemented from idVec3_t.

ID_INLINE float & operator[] int  index  ) 
 

Reimplemented from idVec3_t.

Definition at line 552 of file math_vector.h.

References ID_INLINE.

00552                                                {
00553     return ( &x )[ index ];
00554 }

ID_INLINE float operator[] int  index  )  const
 

Reimplemented from idVec3_t.

Definition at line 548 of file math_vector.h.

References ID_INLINE.

00548                                                     {
00549     return ( &x )[ index ];
00550 }

void set const float  x,
const float  y,
const float  z
[inherited]
 

ID_INLINE void set const float  x,
const float  y,
const float  z
[inherited]
 

Definition at line 218 of file math_vector.h.

References ID_INLINE, x, y, and z.

Referenced by idInterpolatedPosition::addPoint(), idFixedPosition::addPoint(), idSplineList::clear(), mat3_t::Clear(), and angles_t::toVectors().

00218                                                                           {
00219     this->x = x;
00220     this->y = y;
00221     this->z = z;
00222 }

void Snap void   )  [inherited]
 

ID_INLINE void Snap void   )  [inherited]
 

Definition at line 340 of file math_vector.h.

References ID_INLINE, idVec3_t::x, idVec3_t::y, and idVec3_t::z.

Referenced by idSplineList::setSelectedPoint().

00340                                     {
00341     x = float( int( x ) );
00342     y = float( int( y ) );
00343     z = float( int( z ) );
00344 }

void SnapTowards const idVec3_t to  )  [inherited]
 

ID_INLINE void SnapTowards const idVec3_t to  )  [inherited]
 

Definition at line 356 of file math_vector.h.

References ID_INLINE, idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00356                                                          {
00357     if ( to.x <= x ) {
00358         x = float( int( x ) );
00359     } else {
00360         x = float( int( x ) + 1 );
00361     }
00362 
00363     if ( to.y <= y ) {
00364         y = float( int( y ) );
00365     } else {
00366         y = float( int( y ) + 1 );
00367     }
00368 
00369     if ( to.z <= z ) {
00370         z = float( int( z ) );
00371     } else {
00372         z = float( int( z ) + 1 );
00373     }
00374 }

char* string void   )  [inherited]
 

char * string void   )  [inherited]
 

Definition at line 132 of file math_vector.cpp.

References s, sprintf(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

Referenced by CG_DrawBlueName(), and CG_DrawRedName().

00132                              {
00133     static  int     index = 0;
00134     static  char    str[ 8 ][ 36 ];
00135     char    *s;
00136 
00137     // use an array so that multiple toString's won't collide
00138     s = str[ index ];
00139     index = (index + 1)&7;
00140 
00141     sprintf( s, "%.2f %.2f %.2f", x, y, z );
00142 
00143     return s;
00144 }

Here is the call graph for this function:

angles_t toAngles void   )  [inherited]
 

angles_t toAngles void   )  [inherited]
 

float toPitch void   )  [inherited]
 

float toPitch void   )  [inherited]
 

Definition at line 56 of file math_vector.cpp.

References atan2(), idSqrt(), idVec3_t::x, idVec3_t::y, and idVec3_t::z.

00056                               {
00057     float   forward;
00058     float   pitch;
00059     
00060     if ( ( x == 0 ) && ( y == 0 ) ) {
00061         if ( z > 0 ) {
00062             pitch = 90;
00063         } else {
00064             pitch = 270;
00065         }
00066     } else {
00067         forward = ( float )idSqrt( x * x + y * y );
00068         pitch = atan2( z, forward ) * 180 / M_PI;
00069         if ( pitch < 0 ) {
00070             pitch += 360;
00071         }
00072     }
00073 
00074     return pitch;
00075 }

Here is the call graph for this function:

float toYaw void   )  [inherited]
 

float toYaw void   )  [inherited]
 

Definition at line 41 of file math_vector.cpp.

References atan2(), idVec3_t::x, and idVec3_t::y.

00041                             {
00042     float yaw;
00043     
00044     if ( ( y == 0 ) && ( x == 0 ) ) {
00045         yaw = 0;
00046     } else {
00047         yaw = atan2( y, x ) * 180 / M_PI;
00048         if ( yaw < 0 ) {
00049             yaw += 360;
00050         }
00051     }
00052 
00053     return yaw;
00054 }

Here is the call graph for this function:

void Zero void   )  [inherited]
 

ID_INLINE void Zero void   )  [inherited]
 

Definition at line 334 of file math_vector.h.

References ID_INLINE, idVec3_t::x, idVec3_t::y, and idVec3_t::z.

Referenced by idInterpolatedPosition::init(), and idFixedPosition::init().

00334                                     {
00335     x = 0.0f;
00336     y = 0.0f;
00337     z = 0.0f;
00338 }


Friends And Related Function Documentation

idVec3_t LerpVector const idVec3_t w1,
const idVec3_t w2,
const float  t
[friend, inherited]
 

idVec3_t LerpVector const idVec3_t w1,
const idVec3_t w2,
const float  t
[friend, inherited]
 

idVec3_t operator * float  a,
idVec3_t  b
[friend, inherited]
 

Definition at line 236 of file math_vector.h.

00236                                                                 {
00237     return idVec3_t( b.x * a, b.y * a, b.z * a );
00238 }

idVec3_t operator * float  a,
idVec3_t  b
[friend, inherited]
 

Definition at line 236 of file math_vector.h.

00236                                                                 {
00237     return idVec3_t( b.x * a, b.y * a, b.z * a );
00238 }


Field Documentation

float dist
 

Definition at line 528 of file math_vector.h.

float x [inherited]
 

Definition at line 126 of file math_vector.h.

Referenced by angles_t::angles_t(), idVec3_t::Cross(), glLabeledPoint(), mat3_t::Identity(), idVec3_t::Length(), mat3_t::mat3_t(), idVec3_t::Normalize(), idVec3_t::operator *(), operator *(), mat3_t::operator *(), idVec3_t::operator *=(), mat3_t::operator *=(), idVec3_t::operator!=(), idVec3_t::operator+(), idVec3_t::operator+=(), mat3_t::operator+=(), angles_t::operator+=(), idVec3_t::operator-(), idVec3_t::operator-=(), mat3_t::operator-=(), idVec3_t::operator=(), idVec3_t::operator==(), mat3_t::ProjectVector(), idVec3_t::Snap(), idVec3_t::SnapTowards(), idVec3_t::string(), idVec3_t::toPitch(), idVec3_t::toYaw(), idInterpolatedPosition::write(), idFixedPosition::write(), and idVec3_t::Zero().

float y [inherited]
 

Definition at line 126 of file math_vector.h.

Referenced by angles_t::angles_t(), idVec3_t::Cross(), glLabeledPoint(), mat3_t::Identity(), idVec3_t::Length(), mat3_t::mat3_t(), idVec3_t::Normalize(), idVec3_t::operator *(), operator *(), mat3_t::operator *(), idVec3_t::operator *=(), mat3_t::operator *=(), idVec3_t::operator!=(), idVec3_t::operator+(), idVec3_t::operator+=(), mat3_t::operator+=(), angles_t::operator+=(), idVec3_t::operator-(), idVec3_t::operator-=(), mat3_t::operator-=(), idVec3_t::operator=(), idVec3_t::operator==(), mat3_t::ProjectVector(), idVec3_t::Snap(), idVec3_t::SnapTowards(), idVec3_t::string(), idVec3_t::toPitch(), idVec3_t::toYaw(), idInterpolatedPosition::write(), idFixedPosition::write(), and idVec3_t::Zero().

float z [inherited]
 

Definition at line 126 of file math_vector.h.

Referenced by angles_t::angles_t(), idVec3_t::Cross(), glLabeledPoint(), mat3_t::Identity(), idVec3_t::Length(), mat3_t::mat3_t(), idVec3_t::Normalize(), idVec3_t::operator *(), operator *(), mat3_t::operator *(), idVec3_t::operator *=(), mat3_t::operator *=(), idVec3_t::operator!=(), idVec3_t::operator+(), idVec3_t::operator+=(), mat3_t::operator+=(), angles_t::operator+=(), idVec3_t::operator-(), idVec3_t::operator-=(), mat3_t::operator-=(), idVec3_t::operator=(), idVec3_t::operator==(), mat3_t::ProjectVector(), idVec3_t::Snap(), idVec3_t::SnapTowards(), idVec3_t::string(), idVec3_t::toPitch(), idInterpolatedPosition::write(), idFixedPosition::write(), and idVec3_t::Zero().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 20:02:10 2005 for Quake III Arena by  doxygen 1.3.9.1