Blender V5.3
gpu_shader_math_rotation_conversion.bsl.hh File Reference

Go to the source code of this file.

Namespaces

namespace  detail

Functions

Quaternion detail::normalized_to_quat_fast (float3x3 mat)
Quaternion detail::normalized_to_quat_with_checks (float3x3 mat)
void detail::normalized_to_eul2 (float3x3 mat, EulerXYZ &eul1, EulerXYZ &eul2)
Quaternion Functions
Quaternion to_quaternion (EulerXYZ eul)
Quaternion to_quaternion (float3x3 mat)
Quaternion to_quaternion (float3x3 mat, const bool normalized)
Quaternion to_quaternion (float4x4 mat)
Quaternion to_quaternion (float4x4 mat, const bool normalized)
Quaternion to_quaternion (AxisAngle axis_angle)
Quaternion to_quaternion (float3 axis, float angle)
Euler Functions
EulerXYZ to_euler (float3x3 mat, const bool normalized)
EulerXYZ to_euler (float3x3 mat)
EulerXYZ to_euler (float4x4 mat, const bool normalized)
EulerXYZ to_euler (float4x4 mat)
Axis Angle Functions
AxisAngle to_axis_angle (Quaternion quat)
AxisAngle to_axis_angle (EulerXYZ eul)
Matrices Functions
void to_rot_scale (float3x3 mat, EulerXYZ &r_rotation, float3 &r_scale)
void to_rot_scale (float3x3 mat, EulerXYZ &r_rotation, float3 &r_scale, const bool allow_negative_scale)
void to_rot_scale (float3x3 mat, Quaternion &r_rotation, float3 &r_scale)
void to_rot_scale (float3x3 mat, Quaternion &r_rotation, float3 &r_scale, const bool allow_negative_scale)
void to_loc_rot_scale (float4x4 mat, float3 &r_location, EulerXYZ &r_rotation, float3 &r_scale)
void to_loc_rot_scale (float4x4 mat, float3 &r_location, EulerXYZ &r_rotation, float3 &r_scale, const bool allow_negative_scale)
void to_loc_rot_scale (float4x4 mat, float3 &r_location, Quaternion &r_rotation, float3 &r_scale)
void to_loc_rot_scale (float4x4 mat, float3 &r_location, Quaternion &r_rotation, float3 &r_scale, const bool allow_negative_scale)

Function Documentation

◆ to_axis_angle() [1/2]

AxisAngle to_axis_angle ( EulerXYZ eul)

Definition at line 301 of file gpu_shader_math_rotation_conversion.bsl.hh.

References to_axis_angle(), and to_quaternion().

◆ to_axis_angle() [2/2]

◆ to_euler() [1/4]

EulerXYZ to_euler ( float3x3 mat)

Extract euler rotation from transform matrix.

Returns
the rotation with the smallest values from the potential candidates.

Definition at line 254 of file gpu_shader_math_rotation_conversion.bsl.hh.

References to_euler().

◆ to_euler() [2/4]

EulerXYZ to_euler ( float3x3 mat,
const bool normalized )

Extract euler rotation from transform matrix.

Returns
the rotation with the smallest values from the potential candidates.

Definition at line 240 of file gpu_shader_math_rotation_conversion.bsl.hh.

References EulerXYZ::as_float3(), length_manhattan(), normalize, normalized(), detail::normalized_to_eul2(), and to_euler().

Referenced by gpu_math_test_main(), rotation_to_euler(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), to_euler(), to_euler(), to_euler(), to_euler(), to_rot_scale(), and to_rot_scale().

◆ to_euler() [3/4]

EulerXYZ to_euler ( float4x4 mat)

Extract euler rotation from transform matrix.

Returns
the rotation with the smallest values from the potential candidates.

Definition at line 270 of file gpu_shader_math_rotation_conversion.bsl.hh.

References to_euler().

◆ to_euler() [4/4]

EulerXYZ to_euler ( float4x4 mat,
const bool normalized )

Extract euler rotation from transform matrix.

Returns
the rotation with the smallest values from the potential candidates.

Definition at line 262 of file gpu_shader_math_rotation_conversion.bsl.hh.

References normalized(), and to_euler().

◆ to_loc_rot_scale() [1/4]

◆ to_loc_rot_scale() [2/4]

void to_loc_rot_scale ( float4x4 mat,
float3 & r_location,
EulerXYZ & r_rotation,
float3 & r_scale,
const bool allow_negative_scale )

◆ to_loc_rot_scale() [3/4]

void to_loc_rot_scale ( float4x4 mat,
float3 & r_location,
Quaternion & r_rotation,
float3 & r_scale )

◆ to_loc_rot_scale() [4/4]

void to_loc_rot_scale ( float4x4 mat,
float3 & r_location,
Quaternion & r_rotation,
float3 & r_scale,
const bool allow_negative_scale )

◆ to_quaternion() [1/7]

Quaternion to_quaternion ( AxisAngle axis_angle)

Using half angle identities: sin(angle / 2) = sqrt((1 - angle_cos) / 2)

Definition at line 198 of file gpu_shader_math_rotation_conversion.bsl.hh.

References AxisAngle::angle, AxisAngle::axis, cos, sin, sqrt, to_quaternion(), Quaternion::w, Quaternion::x, Quaternion::y, and Quaternion::z.

◆ to_quaternion() [2/7]

◆ to_quaternion() [3/7]

◆ to_quaternion() [4/7]

Quaternion to_quaternion ( float3x3 mat)

Extract quaternion rotation from transform matrix.

Note
normalized is set to false by default.

Definition at line 166 of file gpu_shader_math_rotation_conversion.bsl.hh.

References normalize, detail::normalized_to_quat_with_checks(), and to_quaternion().

◆ to_quaternion() [5/7]

Quaternion to_quaternion ( float3x3 mat,
const bool normalized )

Extract quaternion rotation from transform matrix.

Note
normalized is set to false by default.

Definition at line 174 of file gpu_shader_math_rotation_conversion.bsl.hh.

References normalize, normalized(), and to_quaternion().

◆ to_quaternion() [6/7]

Quaternion to_quaternion ( float4x4 mat)

Extract quaternion rotation from transform matrix.

Note
normalized is set to false by default.

Definition at line 185 of file gpu_shader_math_rotation_conversion.bsl.hh.

References to_quaternion().

◆ to_quaternion() [7/7]

Quaternion to_quaternion ( float4x4 mat,
const bool normalized )

Extract quaternion rotation from transform matrix.

Note
normalized is set to false by default.

Definition at line 193 of file gpu_shader_math_rotation_conversion.bsl.hh.

References normalized(), and to_quaternion().

◆ to_rot_scale() [1/4]

void to_rot_scale ( float3x3 mat,
EulerXYZ & r_rotation,
float3 & r_scale )

Decompose a matrix into location, rotation, and scale components.

Template Parameters
allow_negative_scaleif true, will compute determinant to know if matrix is negative. Rotation and scale values will be flipped if it is negative. This is a costly operation so it is disabled by default.

Definition at line 319 of file gpu_shader_math_rotation_conversion.bsl.hh.

References to_euler(), to_rot_scale(), and to_scale().

Referenced by gpu_math_test_main(), blender::tests::TEST(), to_loc_rot_scale(), to_loc_rot_scale(), to_loc_rot_scale(), to_loc_rot_scale(), to_rot_scale(), to_rot_scale(), to_rot_scale(), and to_rot_scale().

◆ to_rot_scale() [2/4]

void to_rot_scale ( float3x3 mat,
EulerXYZ & r_rotation,
float3 & r_scale,
const bool allow_negative_scale )

Decompose a matrix into location, rotation, and scale components.

Template Parameters
allow_negative_scaleif true, will compute determinant to know if matrix is negative. Rotation and scale values will be flipped if it is negative. This is a costly operation so it is disabled by default.

Definition at line 331 of file gpu_shader_math_rotation_conversion.bsl.hh.

References is_negative(), normalize_and_get_size(), to_euler(), and to_rot_scale().

◆ to_rot_scale() [3/4]

void to_rot_scale ( float3x3 mat,
Quaternion & r_rotation,
float3 & r_scale )

◆ to_rot_scale() [4/4]

void to_rot_scale ( float3x3 mat,
Quaternion & r_rotation,
float3 & r_scale,
const bool allow_negative_scale )