RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
irrklang::vec3d< T > Class Template Reference

a 3d vector template class for representing vectors and points in 3d More...

#include <ik_vec3d.h>

Public Member Functions

 vec3d ()
 
 vec3d (T nx, T ny, T nz)
 
 vec3d (const vec3d< T > &other)
 
vec3d< T > operator- () const
 constructor creating an irrklang vec3d from an irrlicht vector. More...
 
vec3d< T > & operator= (const vec3d< T > &other)
 
vec3d< T > operator+ (const vec3d< T > &other) const
 
vec3d< T > & operator+= (const vec3d< T > &other)
 
vec3d< T > operator- (const vec3d< T > &other) const
 
vec3d< T > & operator-= (const vec3d< T > &other)
 
vec3d< T > operator* (const vec3d< T > &other) const
 
vec3d< T > & operator*= (const vec3d< T > &other)
 
vec3d< T > operator* (const T v) const
 
vec3d< T > & operator*= (const T v)
 
vec3d< T > operator/ (const vec3d< T > &other) const
 
vec3d< T > & operator/= (const vec3d< T > &other)
 
vec3d< T > operator/ (const T v) const
 
vec3d< T > & operator/= (const T v)
 
bool operator<= (const vec3d< T > &other) const
 
bool operator>= (const vec3d< T > &other) const
 
bool operator== (const vec3d< T > &other) const
 
bool operator!= (const vec3d< T > &other) const
 
bool equals (const vec3d< T > &other)
 returns if this vector equalsfloat the other one, taking floating point rounding errors into account More...
 
void set (const T nx, const T ny, const T nz)
 
void set (const vec3d< T > &p)
 
ik_f64 getLength () const
 Returns length of the vector. More...
 
ik_f64 getLengthSQ () const
 Returns squared length of the vector. More...
 
dotProduct (const vec3d< T > &other) const
 Returns the dot product with another vector. More...
 
ik_f64 getDistanceFrom (const vec3d< T > &other) const
 Returns distance from an other point. More...
 
ik_f32 getDistanceFromSQ (const vec3d< T > &other) const
 Returns squared distance from an other point. More...
 
vec3d< T > crossProduct (const vec3d< T > &p) const
 Calculates the cross product with another vector. More...
 
bool isBetweenPoints (const vec3d< T > &begin, const vec3d< T > &end) const
 Returns if this vector interpreted as a point is on a line between two other points. More...
 
vec3d< T > & normalize ()
 Normalizes the vector. More...
 
void setLength (T newlength)
 Sets the lenght of the vector to a new value. More...
 
void invert ()
 Inverts the vector. More...
 
void rotateXZBy (ik_f64 degrees, const vec3d< T > &center)
 
void rotateXYBy (ik_f64 degrees, const vec3d< T > &center)
 
void rotateYZBy (ik_f64 degrees, const vec3d< T > &center)
 
vec3d< T > getInterpolated (const vec3d< T > &other, ik_f32 d) const
 Returns interpolated vector. More...
 
vec3d< T > getHorizontalAngle ()
 Gets the Y and Z rotations of a vector. More...
 
void getAs4Values (T *array)
 Fills an array of 4 values with the vector data (usually floats). More...
 

Public Attributes

X
 
Y
 
Z
 

Detailed Description

template<class T>
class irrklang::vec3d< T >

a 3d vector template class for representing vectors and points in 3d

Definition at line 17 of file ik_vec3d.h.

Constructor & Destructor Documentation

template<class T>
irrklang::vec3d< T >::vec3d ( )
inline

Definition at line 21 of file ik_vec3d.h.

template<class T>
irrklang::vec3d< T >::vec3d ( nx,
ny,
nz 
)
inline

Definition at line 22 of file ik_vec3d.h.

template<class T>
irrklang::vec3d< T >::vec3d ( const vec3d< T > &  other)
inline

Definition at line 23 of file ik_vec3d.h.

Member Function Documentation

template<class T>
vec3d<T> irrklang::vec3d< T >::crossProduct ( const vec3d< T > &  p) const
inline

Calculates the cross product with another vector.

Definition at line 103 of file ik_vec3d.h.

template<class T>
T irrklang::vec3d< T >::dotProduct ( const vec3d< T > &  other) const
inline

Returns the dot product with another vector.

Definition at line 81 of file ik_vec3d.h.

template<class T>
bool irrklang::vec3d< T >::equals ( const vec3d< T > &  other)
inline

returns if this vector equalsfloat the other one, taking floating point rounding errors into account

Definition at line 62 of file ik_vec3d.h.

template<class T>
void irrklang::vec3d< T >::getAs4Values ( T *  array)
inline

Fills an array of 4 values with the vector data (usually floats).

Useful for setting in shader constants for example. The fourth value will always be 0.

Definition at line 234 of file ik_vec3d.h.

template<class T>
ik_f64 irrklang::vec3d< T >::getDistanceFrom ( const vec3d< T > &  other) const
inline

Returns distance from an other point.

Here, the vector is interpreted as point in 3 dimensional space.

Definition at line 88 of file ik_vec3d.h.

template<class T>
ik_f32 irrklang::vec3d< T >::getDistanceFromSQ ( const vec3d< T > &  other) const
inline

Returns squared distance from an other point.

Here, the vector is interpreted as point in 3 dimensional space.

Definition at line 96 of file ik_vec3d.h.

template<class T>
vec3d<T> irrklang::vec3d< T >::getHorizontalAngle ( )
inline

Gets the Y and Z rotations of a vector.

Thanks to Arras on the Irrlicht forums to add this method.

Returns
A vector representing the rotation in degrees of this vector. The Z component of the vector will always be 0.

Definition at line 209 of file ik_vec3d.h.

template<class T>
vec3d<T> irrklang::vec3d< T >::getInterpolated ( const vec3d< T > &  other,
ik_f32  d 
) const
inline

Returns interpolated vector.

Parameters
otherother vector to interpolate between
dvalue between 0.0f and 1.0f.

Definition at line 197 of file ik_vec3d.h.

template<class T>
ik_f64 irrklang::vec3d< T >::getLength ( ) const
inline

Returns length of the vector.

Definition at line 73 of file ik_vec3d.h.

template<class T>
ik_f64 irrklang::vec3d< T >::getLengthSQ ( ) const
inline

Returns squared length of the vector.

This is useful because it is much faster then getLength().

Definition at line 78 of file ik_vec3d.h.

template<class T>
void irrklang::vec3d< T >::invert ( )
inline

Inverts the vector.

Definition at line 139 of file ik_vec3d.h.

template<class T>
bool irrklang::vec3d< T >::isBetweenPoints ( const vec3d< T > &  begin,
const vec3d< T > &  end 
) const
inline

Returns if this vector interpreted as a point is on a line between two other points.

It is assumed that the point is on the line.

Definition at line 110 of file ik_vec3d.h.

template<class T>
vec3d<T>& irrklang::vec3d< T >::normalize ( )
inline

Normalizes the vector.

Definition at line 118 of file ik_vec3d.h.

template<class T>
bool irrklang::vec3d< T >::operator!= ( const vec3d< T > &  other) const
inline

Definition at line 57 of file ik_vec3d.h.

template<class T>
vec3d<T> irrklang::vec3d< T >::operator* ( const vec3d< T > &  other) const
inline

Definition at line 43 of file ik_vec3d.h.

template<class T>
vec3d<T> irrklang::vec3d< T >::operator* ( const T  v) const
inline

Definition at line 45 of file ik_vec3d.h.

template<class T>
vec3d<T>& irrklang::vec3d< T >::operator*= ( const vec3d< T > &  other)
inline

Definition at line 44 of file ik_vec3d.h.

template<class T>
vec3d<T>& irrklang::vec3d< T >::operator*= ( const T  v)
inline

Definition at line 46 of file ik_vec3d.h.

template<class T>
vec3d<T> irrklang::vec3d< T >::operator+ ( const vec3d< T > &  other) const
inline

Definition at line 37 of file ik_vec3d.h.

template<class T>
vec3d<T>& irrklang::vec3d< T >::operator+= ( const vec3d< T > &  other)
inline

Definition at line 38 of file ik_vec3d.h.

template<class T>
vec3d<T> irrklang::vec3d< T >::operator- ( ) const
inline

constructor creating an irrklang vec3d from an irrlicht vector.

Definition at line 33 of file ik_vec3d.h.

template<class T>
vec3d<T> irrklang::vec3d< T >::operator- ( const vec3d< T > &  other) const
inline

Definition at line 40 of file ik_vec3d.h.

template<class T>
vec3d<T>& irrklang::vec3d< T >::operator-= ( const vec3d< T > &  other)
inline

Definition at line 41 of file ik_vec3d.h.

template<class T>
vec3d<T> irrklang::vec3d< T >::operator/ ( const vec3d< T > &  other) const
inline

Definition at line 48 of file ik_vec3d.h.

template<class T>
vec3d<T> irrklang::vec3d< T >::operator/ ( const T  v) const
inline

Definition at line 50 of file ik_vec3d.h.

template<class T>
vec3d<T>& irrklang::vec3d< T >::operator/= ( const vec3d< T > &  other)
inline

Definition at line 49 of file ik_vec3d.h.

template<class T>
vec3d<T>& irrklang::vec3d< T >::operator/= ( const T  v)
inline

Definition at line 51 of file ik_vec3d.h.

template<class T>
bool irrklang::vec3d< T >::operator<= ( const vec3d< T > &  other) const
inline

Definition at line 53 of file ik_vec3d.h.

template<class T>
vec3d<T>& irrklang::vec3d< T >::operator= ( const vec3d< T > &  other)
inline

Definition at line 35 of file ik_vec3d.h.

template<class T>
bool irrklang::vec3d< T >::operator== ( const vec3d< T > &  other) const
inline

Definition at line 56 of file ik_vec3d.h.

template<class T>
bool irrklang::vec3d< T >::operator>= ( const vec3d< T > &  other) const
inline

Definition at line 54 of file ik_vec3d.h.

template<class T>
void irrklang::vec3d< T >::rotateXYBy ( ik_f64  degrees,
const vec3d< T > &  center 
)
inline

Rotates the vector by a specified number of degrees around the Z axis and the specified center.

Parameters
degreesNumber of degrees to rotate around the Z axis.
centerThe center of the rotation.

Definition at line 166 of file ik_vec3d.h.

template<class T>
void irrklang::vec3d< T >::rotateXZBy ( ik_f64  degrees,
const vec3d< T > &  center 
)
inline

Rotates the vector by a specified number of degrees around the Y axis and the specified center.

Parameters
degreesNumber of degrees to rotate around the Y axis.
centerThe center of the rotation.

Definition at line 150 of file ik_vec3d.h.

template<class T>
void irrklang::vec3d< T >::rotateYZBy ( ik_f64  degrees,
const vec3d< T > &  center 
)
inline

Rotates the vector by a specified number of degrees around the X axis and the specified center.

Parameters
degreesNumber of degrees to rotate around the X axis.
centerThe center of the rotation.

Definition at line 182 of file ik_vec3d.h.

template<class T>
void irrklang::vec3d< T >::set ( const T  nx,
const T  ny,
const T  nz 
)
inline

Definition at line 69 of file ik_vec3d.h.

template<class T>
void irrklang::vec3d< T >::set ( const vec3d< T > &  p)
inline

Definition at line 70 of file ik_vec3d.h.

template<class T>
void irrklang::vec3d< T >::setLength ( newlength)
inline

Sets the lenght of the vector to a new value.

Definition at line 132 of file ik_vec3d.h.

Member Data Documentation

template<class T>
T irrklang::vec3d< T >::X

Definition at line 245 of file ik_vec3d.h.

template<class T>
T irrklang::vec3d< T >::Y

Definition at line 245 of file ik_vec3d.h.

template<class T>
T irrklang::vec3d< T >::Z

Definition at line 245 of file ik_vec3d.h.


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