59 inline Vector3(
float x = 0,
float y = 0,
float z = 0) :
60 m_x(x), m_y(y), m_z(z)
68 inline const float&
x()
const
77 inline const float&
y()
const
86 inline const float&
z()
const
95 inline void get(
float* destination)
const
97 std::memcpy(destination, m_v,
sizeof(m_v));
113 inline const float*
get()
const
124 return std::sqrt(m_x*m_x + m_y*m_y + m_z*m_z);
134 return Vector3(m_y * op.m_z - m_z * op.m_y,
135 m_z * op.m_x - m_x * op.m_z,
136 m_x * op.m_y - m_y * op.m_x);
146 return m_x * op.m_x + m_y * op.m_y + m_z * op.m_z;
156 return Vector3(m_x * op, m_y * op, m_z * op);
166 return Vector3(m_x + op.m_x, m_y + op.m_y, m_z + op.m_z);
176 return Vector3(m_x - op.m_x, m_y - op.m_y, m_z - op.m_z);
185 return Vector3(-m_x, -m_y, -m_z);
231 inline Quaternion(
float w = 1,
float x = 0,
float y = 0,
float z = 0) :
232 m_w(w), m_x(x), m_y(y), m_z(z)
240 inline const float&
w()
const
249 inline const float&
x()
const
258 inline const float&
y()
const
267 inline const float&
z()
const
276 inline void get(
float* destination)
const
278 std::memcpy(destination, m_v,
sizeof(m_v));
294 inline const float*
get()
const
306 return Vector3(-2 * (m_w * m_y + m_x * m_z),
307 2 * (m_x * m_w - m_z * m_y),
308 2 * (m_x * m_x + m_y * m_y) - 1);
318 return Vector3(2 * (m_x * m_y - m_w * m_z),
319 1 - 2 * (m_x * m_x + m_z * m_z),
320 2 * (m_w * m_x + m_y * m_z));
The main header file of the library defining the namespace and basic data types.
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition Audaspace.h:119
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition Audaspace.h:116
#define AUD_API
Used for exporting symbols in the shared library.
Definition Audaspace.h:93
This class represents a quaternion used for 3D rotations.
Definition Math3D.h:206
Vector3 getLookAt() const
When the quaternion represents an orientation, this returns the negative z axis vector.
Definition Math3D.h:304
Vector3 getUp() const
When the quaternion represents an orientation, this returns the y axis vector.
Definition Math3D.h:316
const float & y() const
Retrieves the y component of the quarternion.
Definition Math3D.h:258
const float & x() const
Retrieves the x component of the quarternion.
Definition Math3D.h:249
const float & w() const
Retrieves the w component of the quarternion.
Definition Math3D.h:240
Quaternion(float w=1, float x=0, float y=0, float z=0)
Creates a new quaternion.
Definition Math3D.h:231
float * get()
Retrieves the components of the vector.
Definition Math3D.h:285
void get(float *destination) const
Retrieves the components of the vector.
Definition Math3D.h:276
const float * get() const
Retrieves the components of the vector.
Definition Math3D.h:294
const float & z() const
Retrieves the z component of the quarternion.
Definition Math3D.h:267
This class represents a 3 dimensional vector.
Definition Math3D.h:36
const float & x() const
Retrieves the x component of the vector.
Definition Math3D.h:68
Vector3 operator-(const Vector3 &op) const
Subtracts two vectors.
Definition Math3D.h:174
Vector3 operator*(const float &op) const
Retrieves the product with a scalar.
Definition Math3D.h:154
Vector3 cross(const Vector3 &op) const
Retrieves the cross product.
Definition Math3D.h:132
float * get()
Retrieves the components of the vector.
Definition Math3D.h:104
Vector3 & operator-=(const Vector3 &op)
Subtracts the second vector.
Definition Math3D.h:193
const float & y() const
Retrieves the y component of the vector.
Definition Math3D.h:77
float operator*(const Vector3 &op) const
Retrieves the dot product.
Definition Math3D.h:144
Vector3 operator+(const Vector3 &op) const
Adds two vectors.
Definition Math3D.h:164
Vector3(float x=0, float y=0, float z=0)
Creates a new 3 dimensional vector.
Definition Math3D.h:59
Vector3 operator-() const
Negates the vector.
Definition Math3D.h:183
float length() const
Retrieves the length of the vector.
Definition Math3D.h:122
const float * get() const
Retrieves the components of the vector.
Definition Math3D.h:113
void get(float *destination) const
Retrieves the components of the vector.
Definition Math3D.h:95
const float & z() const
Retrieves the z component of the vector.
Definition Math3D.h:86