# irrklang::vec3d< T > Class Template Reference

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

`#include <ik_vec3d.h>`

List of all members.

## 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.
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
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.
ik_f64 | getLengthSQ () const
| Returns squared length of the vector.
T | dotProduct (const vec3d< T > &other) const
| Returns the dot product with another vector.
ik_f64 | getDistanceFrom (const vec3d< T > &other) const
| Returns distance from an other point.
ik_f32 | getDistanceFromSQ (const vec3d< T > &other) const
| Returns squared distance from an other point.
vec3d< T > | crossProduct (const vec3d< T > &p) const
| Calculates the cross product with another vector.
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.
vec3d< T > & | normalize ()
| Normalizes the vector.
void | setLength (T newlength)
| Sets the lenght of the vector to a new value.
void | invert ()
| Inverts the vector.
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.
vec3d< T > | getHorizontalAngle ()
| Gets the Y and Z rotations of a vector.
void | getAs4Values (T *array)
| Fills an array of 4 values with the vector data (usually floats).

## Public Attributes

T | X
T | Y
T | Z

## Detailed Description

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

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

## Constructor & Destructor Documentation

template<class T>

irrklang::vec3d< T >::vec3d | ( |  | ) | `[inline]`

template<class T>

irrklang::vec3d< T >::vec3d | ( | T | nx,
|  | T | ny,
|  | T | nz |
| ) |  |  | `[inline]`

template<class T>

irrklang::vec3d< T >::vec3d | ( | const vec3d< T > & | other | ) | `[inline]`

## 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.

template<class T>

T irrklang::vec3d< T >::dotProduct | ( | const vec3d< T > & | other | ) | const`[inline]`

Returns the dot product with another vector.

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

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.

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.

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.

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.

template<class T>

vec3d<T> irrklang::vec3d< T >::getInterpolated | ( | const vec3d< T > & | other,
|  | ik_f32 | d |
| ) |  |  | const`[inline]`

Returns interpolated vector.

Parameters:

  | other,: | other vector to interpolate between
  | d,: | value between 0.0f and 1.0f.

template<class T>

ik_f64 irrklang::vec3d< T >::getLength | ( |  | ) | const`[inline]`

Returns length of the vector.

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().

template<class T>

void irrklang::vec3d< T >::invert | ( |  | ) | `[inline]`

Inverts the vector.

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.

template<class T>

vec3d<T>& irrklang::vec3d< T >::normalize | ( |  | ) | `[inline]`

Normalizes the vector.

template<class T>

bool irrklang::vec3d< T >::operator!= | ( | const vec3d< T > & | other | ) | const`[inline]`

template<class T>

vec3d<T> irrklang::vec3d< T >::operator* | ( | const T | v | ) | const`[inline]`

template<class T>

vec3d<T> irrklang::vec3d< T >::operator* | ( | const vec3d< T > & | other | ) | const`[inline]`

template<class T>

vec3d<T>& irrklang::vec3d< T >::operator*= | ( | const T | v | ) | `[inline]`

template<class T>

vec3d<T>& irrklang::vec3d< T >::operator*= | ( | const vec3d< T > & | other | ) | `[inline]`

template<class T>

vec3d<T> irrklang::vec3d< T >::operator+ | ( | const vec3d< T > & | other | ) | const`[inline]`

template<class T>

vec3d<T>& irrklang::vec3d< T >::operator+= | ( | const vec3d< T > & | other | ) | `[inline]`

template<class T>

vec3d<T> irrklang::vec3d< T >::operator- | ( | const vec3d< T > & | other | ) | const`[inline]`

template<class T>

vec3d<T> irrklang::vec3d< T >::operator- | ( |  | ) | const`[inline]`

constructor creating an irrklang vec3d from an irrlicht vector.

template<class T>

vec3d<T>& irrklang::vec3d< T >::operator-= | ( | const vec3d< T > & | other | ) | `[inline]`

template<class T>

vec3d<T> irrklang::vec3d< T >::operator/ | ( | const T | v | ) | const`[inline]`

template<class T>

vec3d<T> irrklang::vec3d< T >::operator/ | ( | const vec3d< T > & | other | ) | const`[inline]`

template<class T>

vec3d<T>& irrklang::vec3d< T >::operator/= | ( | const T | v | ) | `[inline]`

template<class T>

vec3d<T>& irrklang::vec3d< T >::operator/= | ( | const vec3d< T > & | other | ) | `[inline]`

template<class T>

bool irrklang::vec3d< T >::operator<= | ( | const vec3d< T > & | other | ) | const`[inline]`

template<class T>

vec3d<T>& irrklang::vec3d< T >::operator= | ( | const vec3d< T > & | other | ) | `[inline]`

template<class T>

bool irrklang::vec3d< T >::operator== | ( | const vec3d< T > & | other | ) | const`[inline]`

template<class T>

bool irrklang::vec3d< T >::operator>= | ( | const vec3d< T > & | other | ) | const`[inline]`

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:

  | degrees,: | Number of degrees to rotate around the Z axis.
  | center,: | The center of the rotation.

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:

  | degrees,: | Number of degrees to rotate around the Y axis.
  | center,: | The center of the rotation.

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:

  | degrees,: | Number of degrees to rotate around the X axis.
  | center,: | The center of the rotation.

template<class T>

void irrklang::vec3d< T >::set | ( | const vec3d< T > & | p | ) | `[inline]`

template<class T>

void irrklang::vec3d< T >::set | ( | const T | nx,
|  | const T | ny,
|  | const T | nz |
| ) |  |  | `[inline]`

template<class T>

void irrklang::vec3d< T >::setLength | ( | T | newlength | ) | `[inline]`

Sets the lenght of the vector to a new value.

## Member Data Documentation

template<class T>

T irrklang::vec3d< T >::X

template<class T>

T irrklang::vec3d< T >::Y

template<class T>

T irrklang::vec3d< T >::Z

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

- ik_vec3d.h

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

| The irrKlang Engine Documentation © 2003-2018 by Nikolaus Gebhardt. Generated by Doxygen (1.6.1)