This page has been translated automatically.
Программирование
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::Math::quat Struct

Header:#include <UnigineMathLib.h>

Quaternion.

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

Usage Example

The following example creates a quaternion for node rotation: 60 degrees per second along Z axis.

Notice
It's supposed that you have already created node instance to rotate.
Source code (C#)
// AppWorldLogic.cpp file

int AppWorldLogic::update()
{
	/* ... */

	// get delta time value
	float delta_time = Game::get()->getIFps();

	// create quat for 60 degrees per second rotation along Z axis
	Unigine::Math::quat rotation_delta = Unigine::Math::quat(0.0f, 0.0f, 1.0f, 60 * delta_time);

	// rotate the node
	node->setNodeWorldRotation(node->getNodeWorldRotation() * delta_rotation);

	/* ... */
}

In the example above, the quaternion was initialized by using four values: 3 axis components (x,y,z) and angle (w component of the quaternion). 1 value of the Z axis component shows that the rotation will be performed along Z axis.

See Also

quat Class

Members


quat(const __m128 & v)

Arguments

  • const __m128 & v

quat(const mat3 & m)

Arguments

  • const mat3 & m

quat(const vec4 & v)

Arguments

  • const vec4 & v

quat(const vec3 & v)

Arguments

  • const vec3 & v

quat()

Default constructor that produces an identity quaternion.

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.

quat(float x, float y, float z, float angle)

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

void set(float x, float y, float z, float angle)

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 angle - W component of the quaternion.

void set(const float * qq)

Set quaternion.

Arguments

  • const float * qq - Pointer to the quaternion.

void set(const mat3 & m)

Arguments

  • const mat3 & m

void set(const vec3 & col0, const vec3 & col1, const vec3 & col2)

Arguments

  • const vec3 & col0
  • const vec3 & col1
  • const vec3 & col2

void set(float angle_x, float angle_y, float angle_z)

Arguments

  • float angle_x
  • float angle_y
  • float angle_z

void set(const vec3 & axis, float angle)

Arguments

  • const vec3 & axis
  • float angle

void set(const vec3 & v)

Arguments

  • const vec3 & v

void set(const dmat4 & m)

Arguments

  • const dmat4 & m

void set(const mat4 & m)

Arguments

  • const mat4 & m

void get(float * qq) const

Get quaternion.

Arguments

  • float * qq - Pointer to the quaternion.

float * get()

Get a pointer to the quaternion.

Return value

Pointer to the quaternion.

const float * get() const

Get a constant pointer to the quaternion.

Return value

Pointer to the quaternion.

void get(vec3 & axis, float & angle)

Arguments

  • vec3 & axis
  • float & angle

float getAngle(const vec3 & axis)

Arguments

  • const vec3 & axis

vec3 getBinormal() const

Returns the quaternion binormal vector with respect to orientation.

Return value

Quaternion binormal.

mat3 getMat3()

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.

quat & normalize()

quat & normalizeFast()

__m128 operator __m128()

const float * operator const float *()

const void * operator const void *()

float * operator float *()

void * operator void *()

quat & operator*=(const quat & q)

Arguments

  • const quat & q

quat & operator*=(float v)

Arguments

  • float v

quat & operator+=(const quat & q)

Arguments

  • const quat & q

quat operator-()

quat & operator-=(const quat & q)

Arguments

  • const quat & q

quat & operator=(const __m128 & v)

Arguments

  • const __m128 & v

quat & operator=(const quat & qq)

Arguments

  • const quat & qq

float & operator[](int i)

Array access.

Arguments

  • int i - Array item index.

Return value

The array item.

float operator[](int i) const

Constant array access.

Arguments

  • int i - Array item index.

Return value

The array item.

__m128 sse()

void sse(const __m128 & v)

Arguments

  • const __m128 & v

int IDENTITY

int ZERO

Last update: 03.07.2017
Build: ()