pgVec Struct Reference
[pgMath -- Mathematics module]

A 3-element vector which is represented by xyz coordinates. More...

#include <pg_vec.h>

List of all members.

Public Member Functions

 pgVec ()
 Constructs a pgVec.
 pgVec (r32 x_, r32 y_, r32 z_=0.0f)
 Constructs and initializes a pgVec from the specified xyz coordinates.
void set (r32 x_, r32 y_, r32 z_=0.0f)
 Sets all components from the specified xyz coordinates.
pgVec operator+ (const pgVec &vec) const
 Returns a pgVec which is the sum of this pgVec and the right hand side pgVec.
void operator+= (const pgVec &vec)
 Adds the right hand side pgVec to this pgVec.
pgVec operator- () const
 Returns a pgVec which is the negative of this pgVec.
pgVec operator- (const pgVec &vec) const
 Returns a pgVec which is the right hand side pgVec subtracted from this pgVec.
void operator-= (const pgVec &vec)
 Subtracts the right hand side pgVec from this pgVec.
pgVec operator* (r32 s) const
 Returns a pgVec which is this pgVec multiplied with the right hand side scalar.
void operator*= (r32 s)
 Multiplies this pgVec with the right hand side scalar.
pgVec operator/ (r32 s) const
 Returns a pgVec which is this pgVec divided by the right hand side scalar.
void operator/= (r32 s)
 Divides this pgVec by the right hand side scalar.
r32 length () const
 Returns the length of this pgVec.
r32 sqLength () const
 Returns the squared length of this pgVec.
r32 dist (const pgVec &vec) const
 Returns the distance between this pgVec and an another pgVec.
r32 sqDist (const pgVec &vec) const
 Returns the squared distance between this pgVec and an another pgVec.
r32 dot (const pgVec &vec) const
 Returns the inner product of this pgVec and an another pgVec.
pgVec cross (const pgVec &vec) const
 Returns the outer product of this pgVec and an another pgVec.
pgVec rotateX_r32 (r32 deg) const
 Returns a pgVec which is this pgVec rotated around the orthonormal x-axis.
pgVec rotateY_r32 (r32 deg) const
 Returns a pgVec which is this pgVec rotated around the orthonormal y-axis.
pgVec rotateZ_r32 (r32 deg) const
 Returns a pgVec which is this pgVec rotated around the orthonormal z-axis.
pgVec rotateX_s32 (s32 deg) const
 Returns a pgVec which is this pgVec rotated around the orthonormal x-axis.
pgVec rotateY_s32 (s32 deg) const
 Returns a pgVec which is this pgVec rotated around the orthonormal y-axis.
pgVec rotateZ_s32 (s32 deg) const
 Returns a pgVec which is this pgVec rotated around the orthonormal z-axis.
pgVec normalize () const
 Returns a pgVec which is the normalized this pgVec.
pgVec interp (const pgVec &to, r32 ratio) const
 Returns a pgVec which is interpolated between this pgVec and an another pgVec by the specified ratio, using linear interpolation.
pgVec slerp (const pgVec &to, r32 ratio) const
 Returns a pgVec which is interpolated between this pgVec and an another pgVec by the specified ratio, using spherical linear interpolation.
pgVec toLocalOf (const pgMat &mat) const
 Returns a pgVec which is this pgVec converted from in the world coordinate system to in the local coordinate system of the specified pgMat.
pgVec toGlobalFrom (const pgMat &mat) const
 Returns a pgVec which is this pgVec converted from in the local coordinate system of the specified pgMat to in the world coordinate system.
pgVec toLocalOf_noTrans (const pgMat &mat) const
 Returns a pgVec which is this pgVec converted from in the world coordinate system to in the local coordinate system of the specified pgMat whose translation is ignored.
pgVec toGlobalFrom_noTrans (const pgMat &mat) const
 Returns a pgVec which is this pgVec converted from in the local coordinate system of the specified pgMat whose translation is ignored to in the world coordinate system.
void toR32x4 (r32 *r32x4, r32 w) const
 Converts this pgVec to a 4-element array.

Static Public Member Functions

static pgVec fromR32x4 (const r32 *r32x4)
 Returns a pgVec which is converted from a 4-element array.
static void mulR32x4 (r32 *res_r32x4, const r32 *lhs_r32x16, const r32 *rhs_r32x4)
 Multiplies a 16-element array by a 4-element array as a matrix and a vector respectively.

Public Attributes

r32 x
 The x-coordinate.
r32 y
 The y-coordinate.
r32 z
 The z-coordinate.

Static Public Attributes

static const pgVec ZERO
 The zero vector.
static const pgVec X_UNIT
 The orthonormal x-axis.
static const pgVec Y_UNIT
 The orthonormal y-axis.
static const pgVec Z_UNIT
 The orthonormal z-axis.

Friends

PG_API friend pgVec operator* (r32 s, const pgVec &vec)
 Returns a pgVec which is the right hand side pgVec multiplied with the left hand side scalar.


Detailed Description

A 3-element vector which is represented by xyz coordinates.

Constructor & Destructor Documentation

pgVec::pgVec ( r32  x_,
r32  y_,
r32  z_ = 0.0f 
)

Constructs and initializes a pgVec from the specified xyz coordinates.

Parameters:
[in] x_ The x-coordinate.
[in] y_ The y-coordinate.
[in] z_ The z-coordinate. If not specified, 0.0f is used.


Member Function Documentation

pgVec pgVec::cross ( const pgVec vec  )  const

Returns the outer product of this pgVec and an another pgVec.

Parameters:
[in] vec An another pgVec.
Returns:
The outer product of two pgVecs.

r32 pgVec::dist ( const pgVec vec  )  const

Returns the distance between this pgVec and an another pgVec.

Parameters:
[in] vec An another pgVec.
Returns:
The distance between two pgVecs.

r32 pgVec::dot ( const pgVec vec  )  const

Returns the inner product of this pgVec and an another pgVec.

Parameters:
[in] vec An another pgVec.
Returns:
The inner product of two pgVecs.

static pgVec pgVec::fromR32x4 ( const r32 *  r32x4  )  [static]

Returns a pgVec which is converted from a 4-element array.

Parameters:
[in] r32x4 A 4-element array to be converted.
Returns:
A pgVec which is converted from the 4-element array.

pgVec pgVec::interp ( const pgVec to,
r32  ratio 
) const

Returns a pgVec which is interpolated between this pgVec and an another pgVec by the specified ratio, using linear interpolation.

Parameters:
[in] to An another pgVec.
[in] ratio The value which indicates how far to interpolate between two pgVecs. This value is clamped between 0.0f and 1.0f.
Returns:
A pgVec which is interpolated between two pgVecs.

r32 pgVec::length (  )  const

Returns the length of this pgVec.

Returns:
The length of this pgVec.

static void pgVec::mulR32x4 ( r32 *  res_r32x4,
const r32 *  lhs_r32x16,
const r32 *  rhs_r32x4 
) [static]

Multiplies a 16-element array by a 4-element array as a matrix and a vector respectively.

Parameters:
[out] res_r32x4 The destination of the multiplied 4-element array.
[in] lhs_r32x16 The left hand side 16-element array.
[in] rhs_r32x4 The right hand side 4-element array.

pgVec pgVec::normalize (  )  const

Returns a pgVec which is the normalized this pgVec.

Returns:
A pgVec which is the normalized this pgVec.

pgVec pgVec::operator* ( r32  s  )  const

Returns a pgVec which is this pgVec multiplied with the right hand side scalar.

Parameters:
[in] s The right hand side scalar.
Returns:
A pgVec which is this pgVec multiplied with the right hand side scalar.

void pgVec::operator*= ( r32  s  ) 

Multiplies this pgVec with the right hand side scalar.

Parameters:
[in] s The right hand side scalar.

pgVec pgVec::operator+ ( const pgVec vec  )  const

Returns a pgVec which is the sum of this pgVec and the right hand side pgVec.

Parameters:
[in] vec The right hand side pgVec.
Returns:
A pgVec which is the sum of two pgVecs.

void pgVec::operator+= ( const pgVec vec  ) 

Adds the right hand side pgVec to this pgVec.

Parameters:
[in] vec The right hand side pgVec.

pgVec pgVec::operator- ( const pgVec vec  )  const

Returns a pgVec which is the right hand side pgVec subtracted from this pgVec.

Parameters:
[in] vec The right hand side pgVec.
Returns:
A pgVec which is the right hand side pgVec subtracted from this pgVec.

pgVec pgVec::operator- (  )  const

Returns a pgVec which is the negative of this pgVec.

Returns:
A pgVec which is the negative of this pgVec.

void pgVec::operator-= ( const pgVec vec  ) 

Subtracts the right hand side pgVec from this pgVec.

Parameters:
[in] vec The right hand side pgVec.

pgVec pgVec::operator/ ( r32  s  )  const

Returns a pgVec which is this pgVec divided by the right hand side scalar.

Parameters:
[in] s The right hand side scalar.
Returns:
A pgVec which is this pgVec divided by the right hand side scalar.

void pgVec::operator/= ( r32  s  ) 

Divides this pgVec by the right hand side scalar.

Parameters:
[in] s The right hand side scalar.

pgVec pgVec::rotateX_r32 ( r32  deg  )  const

Returns a pgVec which is this pgVec rotated around the orthonormal x-axis.

Parameters:
[in] deg An r32 angle of rotation in degrees.
Returns:
A pgVec which is this pgVec rotated around the orthonormal x-axis.

pgVec pgVec::rotateX_s32 ( s32  deg  )  const

Returns a pgVec which is this pgVec rotated around the orthonormal x-axis.

This method allows only an s32 type as an angle, but is faster than its r32 version.

Parameters:
[in] deg An s32 angle of rotation in degrees.
Returns:
A pgVec which is this pgVec rotated around the orthonormal x-axis.

pgVec pgVec::rotateY_r32 ( r32  deg  )  const

Returns a pgVec which is this pgVec rotated around the orthonormal y-axis.

Parameters:
[in] deg An r32 angle of rotation in degrees.
Returns:
A pgVec which is this pgVec rotated around the orthonormal y-axis.

pgVec pgVec::rotateY_s32 ( s32  deg  )  const

Returns a pgVec which is this pgVec rotated around the orthonormal y-axis.

This method allows only an s32 type as an angle, but is faster than its r32 version.

Parameters:
[in] deg An s32 angle of rotation in degrees.
Returns:
A pgVec which is this pgVec rotated around the orthonormal y-axis.

pgVec pgVec::rotateZ_r32 ( r32  deg  )  const

Returns a pgVec which is this pgVec rotated around the orthonormal z-axis.

Parameters:
[in] deg An r32 angle of rotation in degrees.
Returns:
A pgVec which is this pgVec rotated around the orthonormal z-axis.

pgVec pgVec::rotateZ_s32 ( s32  deg  )  const

Returns a pgVec which is this pgVec rotated around the orthonormal z-axis.

This method allows only an s32 type as an angle, but is faster than its r32 version.

Parameters:
[in] deg An s32 angle of rotation in degrees.
Returns:
A pgVec which is this pgVec rotated around the orthonormal z-axis.

void pgVec::set ( r32  x_,
r32  y_,
r32  z_ = 0.0f 
)

Sets all components from the specified xyz coordinates.

Parameters:
[in] x_ The x-coordinate.
[in] y_ The y-coordinate.
[in] z_ The z-coordinate. If not specified, 0.0f is used.

pgVec pgVec::slerp ( const pgVec to,
r32  ratio 
) const

Returns a pgVec which is interpolated between this pgVec and an another pgVec by the specified ratio, using spherical linear interpolation.

Parameters:
[in] to An another pgVec.
[in] ratio The value which indicates how far to interpolate between two pgVecs. This value is clamped between 0.0f and 1.0f.
Returns:
A pgVec which is interpolated between two pgVecs.

r32 pgVec::sqDist ( const pgVec vec  )  const

Returns the squared distance between this pgVec and an another pgVec.

Parameters:
[in] vec An another pgVec.
Returns:
The squared distance between two pgVecs.

r32 pgVec::sqLength (  )  const

Returns the squared length of this pgVec.

Returns:
The squared length of this pgVec.

pgVec pgVec::toGlobalFrom ( const pgMat mat  )  const

Returns a pgVec which is this pgVec converted from in the local coordinate system of the specified pgMat to in the world coordinate system.

Parameters:
[in] mat The origin pgMat of the local coordinate system.
Returns:
A pgVec which is this pgVec in the world coordinate system.

pgVec pgVec::toGlobalFrom_noTrans ( const pgMat mat  )  const

Returns a pgVec which is this pgVec converted from in the local coordinate system of the specified pgMat whose translation is ignored to in the world coordinate system.

Parameters:
[in] mat The origin pgMat of the local coordinate system, whose translation is ignored.
Returns:
A pgVec which is this pgVec in the world coordinate system.

pgVec pgVec::toLocalOf ( const pgMat mat  )  const

Returns a pgVec which is this pgVec converted from in the world coordinate system to in the local coordinate system of the specified pgMat.

Parameters:
[in] mat The origin pgMat of the local coordinate system.
Returns:
A pgVec which is this pgVec in the local coordinate system.

pgVec pgVec::toLocalOf_noTrans ( const pgMat mat  )  const

Returns a pgVec which is this pgVec converted from in the world coordinate system to in the local coordinate system of the specified pgMat whose translation is ignored.

Parameters:
[in] mat The origin pgMat of the local coordinate system, whose translation is ignored.
Returns:
A pgVec which is this pgVec in the local coordinate system.

void pgVec::toR32x4 ( r32 *  r32x4,
r32  w 
) const

Converts this pgVec to a 4-element array.

Parameters:
[out] r32x4 A destination of the converted 4-element array.
[in] w The 4th coordinate of this pgVec.


Friends And Related Function Documentation

PG_API friend pgVec operator* ( r32  s,
const pgVec vec 
) [friend]

Returns a pgVec which is the right hand side pgVec multiplied with the left hand side scalar.

Parameters:
[in] s The left hand side scalar.
[in] vec The right hand side pgVec.
Returns:
A pgVec which is the right hand side pgVec multiplied with the left hand side scalar.


Member Data Documentation

r32 pgVec::x

The x-coordinate.

const pgVec pgVec::X_UNIT [static]

The orthonormal x-axis.

r32 pgVec::y

The y-coordinate.

const pgVec pgVec::Y_UNIT [static]

The orthonormal y-axis.

r32 pgVec::z

The z-coordinate.

const pgVec pgVec::Z_UNIT [static]

The orthonormal z-axis.

const pgVec pgVec::ZERO [static]

The zero vector.


The documentation for this struct was generated from the following file:

Generated on Sat Aug 15 11:24:39 2009 for Pogolyn by  doxygen 1.5.8