Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

# Unigine::quat Struct

Quaternion.

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

## UNIGINE_DECLARE_USE_MEMORY UNIGINE_INLINEquat ()

Default constructor that produces an identity quaternion.

## UNIGINE_INLINEquat (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_INLINEquat (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.

The array item.

## UNIGINE_INLINE floatoperator[] (int i) const

Constant array access.

### Arguments

• int i - Array item index.

The array item.

## UNIGINE_INLINE voidset (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 voidset (const float * q)

Set quaternion.

### Arguments

• const float * q - Pointer to the quaternion.

## UNIGINE_INLINE voidget (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.

## vec3getNormal () const

Returns the quaternion normal vector.

### Return value

Quaternion normal.

## vec3getTangent () const

Returns the quaternion tangent vector.

### Return value

Quaternion tangent.

## vec4getTangent4 () const

Returns the quaternion tangent vector and binormal orientation.

### Return value

Quaternion tangent.

## vec3getBinormal () 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