UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

Unigine::quat Struct

Quaternion.

To use this structure, include the UnigineMathLib.h file.

Unigine::quat Structure

Members


UNIGINE_DECLARE_USE_MEMORY UNIGINE_INLINE quat ()

Default constructor that produces an identity quaternion.

UNIGINE_INLINE quat (const quat & q)

Initialization by a quaternion.

Arguments

  • const quat & q - The value of the quaternion.

quat (const vec3 & axis, float angle)

Initialization by axis and angle values.

Arguments

  • const vec3 & axis - Rotation axis.
  • float angle - Rotation angle (in degrees).

quat (float angle_x, float angle_y, float angle_z)

Initialization by 3 angles.

Arguments

  • float angle_x - Rotation angle along the X axis (in degrees).
  • float angle_y - Rotation angle along the Y axis (in degrees).
  • float angle_z - Rotation angle along the Z axis (in degrees).

quat (const vec3 & col0, const vec3 & col1, const vec3 & col2)

Initialization by 3 matrix columns.

Arguments

  • const vec3 & col0 - First matrix column.
  • const vec3 & col1 - Second matrix column.
  • const vec3 & col2 - Third matrix column.

UNIGINE_INLINE quat (float x, float y, float z, float w)

Initialization by scalars.

Arguments

  • float x - X component of the quaternion.
  • float y - Y component of the quaternion.
  • float z - Z component of the quaternion.
  • float w - W component of the quaternion.

explicit quat (const mat4 & m)

Initialization by a matrix.

Arguments

  • const mat4 & m - The value of the matrix.

explicit quat (const dmat4 & m)

Initialization by a matrix.

Arguments

  • const dmat4 & m - The value of the matrix.

explicit quat (const float * q)

Initialization by a pointer to the quaternion.

Arguments

  • const float * q - Pointer to the quaternion.

UNIGINE_INLINE float & operator[] (int i)

Array access.

Arguments

  • int i - Array item index.

Return value

The array item.

UNIGINE_INLINE float operator[] (int i) const

Constant array access.

Arguments

  • int i - Array item index.

Return value

The array item.

UNIGINE_INLINE void set (float x_, float y_, float z_, float w_)

Set quaternion.

Arguments

  • float x_ - X component of the quaternion.
  • float y_ - Y component of the quaternion.
  • float z_ - Z component of the quaternion.
  • float w_ - W component of the quaternion.

UNIGINE_INLINE void set (const float * q)

Set quaternion.

Arguments

  • const float * q - Pointer to the quaternion.

UNIGINE_INLINE void get (float * q) const

Get quaternion.

Arguments

  • float * q - Pointer to the quaternion.

UNIGINE_INLINE float * get ()

Get a pointer to the quaternion.

Return value

Pointer to the quaternion.

UNIGINE_INLINE const float * get () const

Get a constant pointer to the quaternion.

Return value

Pointer to the quaternion.

vec3 getNormal () const

Returns the quaternion normal vector.

Return value

Quaternion normal.

vec3 getTangent () const

Returns the quaternion tangent vector.

Return value

Quaternion tangent.

vec4 getTangent4 () const

Returns the quaternion tangent vector and binormal orientation.

Return value

Quaternion tangent.

vec3 getBinormal () const

Returns the quaternion binormal vector with respect to orientation.

Return value

Quaternion binormal.

Unigine::quat:: Union

union {
struct {
float x;
float y;
float z;
float w;
};
float q[4];
};
Last update: 2017-07-03