|
Blender V5.0
|
#include <BLI_math_quaternion_types.hh>
Public Member Functions | |
| QuaternionBase ()=default | |
| QuaternionBase (const T &new_w, const T &new_x, const T &new_y, const T &new_z) | |
| QuaternionBase (const VecBase< T, 4 > &vec) | |
| QuaternionBase (const T &real, const VecBase< T, 3 > &imaginary) | |
| operator VecBase< T, 4 > () const | |
| const VecBase< T, 3 > & | imaginary_part () const |
| VecBase< T, 3 > & | imaginary_part () |
| QuaternionBase & | operator*= (const QuaternionBase &b) & |
| uint64_t | hash () const |
Quaternion | |
| AngleRadianBase< T > | twist_angle (const Axis axis) const |
| QuaternionBase | twist (const Axis axis) const |
| QuaternionBase | swing (const Axis axis) const |
| QuaternionBase | wrapped_around (const QuaternionBase &reference) const |
Static Public Member Functions | |
| static QuaternionBase | identity () |
| static QuaternionBase | zero () |
Public Attributes | |
| T | w |
| T | x |
| T | y |
| T | z |
Friends | |
| QuaternionBase | operator* (const QuaternionBase &a, const QuaternionBase &b) |
| QuaternionBase | operator* (const QuaternionBase &a, const T &b) |
| QuaternionBase | operator- (const QuaternionBase &a) |
| std::ostream & | operator<< (std::ostream &stream, const QuaternionBase &rot) |
Conversion from/to Expmap | |
| VecBase< T, 3 > | expmap () const |
| static QuaternionBase | expmap (const VecBase< T, 3 > &expmap) |
A blender::math::QuaternionBase<T> represents either an orientation or a rotation.
Mainly used for rigging and armature deformations as they have nice mathematical properties (eg: smooth shortest path interpolation). A blender::math::QuaternionBase<T> is cheaper to combine than MatBase<T, 3, 3>. However, transforming points is slower. Consider converting to a rotation matrix if you are rotating many points.
See this for more information: https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Performance_comparisons
Definition at line 37 of file BLI_math_quaternion_types.hh.
|
default |
Referenced by expmap(), swing(), twist(), and wrapped_around().
|
inline |
Definition at line 42 of file BLI_math_quaternion_types.hh.
|
inlineexplicit |
Creates a quaternion from an vector without reordering the components.
Definition at line 49 of file BLI_math_quaternion_types.hh.
|
inline |
Creates a quaternion from real (w) and imaginary parts (x, y, z).
Definition at line 54 of file BLI_math_quaternion_types.hh.
| VecBase< T, 3 > blender::math::QuaternionBase< T >::expmap | ( | ) | const |
Create an exponential map representation of this quaternion. An exponential map is basically the rotation axis multiplied by the rotation angle.
Definition at line 692 of file BLI_math_quaternion.hh.
References BLI_assert, expmap(), blender::math::is_unit_scale(), and blender::math::to_axis_angle().
|
static |
Create a quaternion from an exponential map representation. An exponential map is basically the rotation axis multiplied by the rotation angle.
Definition at line 680 of file BLI_math_quaternion.hh.
References angle(), expmap(), identity(), LIKELY, blender::math::normalize_and_get_length(), QuaternionBase(), T, and blender::math::to_quaternion().
Referenced by expmap(), expmap(), blender::bke::attribute_math::mix3(), blender::bke::attribute_math::mix4(), blender::bke::attribute_math::float4x4Mixer::mix_in(), and blender::bke::attribute_math::DefaultMixerStruct< math::Quaternion >::quat_to_expmap().
|
inline |
Definition at line 163 of file BLI_math_quaternion_types.hh.
|
inlinestatic |
Static functions.
Definition at line 59 of file BLI_math_quaternion_types.hh.
Referenced by expmap(), blender::math::from_vector(), blender::math::DualQuaternionBase< float >::identity(), blender::math::invert(), blender::math::normalize_and_get_length(), blender::math::detail::normalized_to_quat_with_checks(), and blender::math::to_quaternion().
|
inline |
Definition at line 115 of file BLI_math_quaternion_types.hh.
|
inline |
Returns the imaginary part of this quaternion (x, y, z).
Definition at line 111 of file BLI_math_quaternion_types.hh.
Referenced by blender::math::pow().
|
inlineexplicit |
Conversions.
Definition at line 78 of file BLI_math_quaternion_types.hh.
|
inline |
Definition at line 143 of file BLI_math_quaternion_types.hh.
| QuaternionBase< T > blender::math::QuaternionBase< T >::swing | ( | const Axis | axis | ) | const |
Returns the swing part of this quaternion for the basis axis direction. The swing is the original quaternion minus the twist around axis. So we have the following identity : q = q.swing(axis) * q.twist(axis)
Definition at line 149 of file BLI_math_quaternion.hh.
References blender::math::abs(), blender::math::Axis::as_int(), BLI_assert, blender::math::canonicalize(), input, blender::math::invert_normalized(), QuaternionBase(), and swing().
Referenced by swing(), and blender::tests::TEST().
| QuaternionBase< T > blender::math::QuaternionBase< T >::twist | ( | const Axis | axis | ) | const |
Returns the twist part of this quaternion for the axis direction. The twist is the isolated rotation in the plane whose axis is normal to.
Definition at line 161 of file BLI_math_quaternion.hh.
References blender::math::Axis::as_int(), blender::math::canonicalize(), blender::math::AngleCartesianBase< T >::cos(), blender::math::AngleCartesianBase< T >::from_point(), QuaternionBase(), blender::math::AngleCartesianBase< T >::sin(), T, twist(), and blender::VecBase< T, Size >::yzw().
Referenced by blender::tests::TEST(), and twist().
| AngleRadianBase< T > blender::math::QuaternionBase< T >::twist_angle | ( | const Axis | axis | ) | const |
Returns the full twist angle for a given axis direction. The twist is the isolated rotation in the plane whose axis is normal to.
Definition at line 141 of file BLI_math_quaternion.hh.
References blender::math::Axis::as_int(), blender::math::canonicalize(), T, and blender::VecBase< T, Size >::yzw().
Referenced by blender::tests::TEST().
| QuaternionBase< T > blender::math::QuaternionBase< T >::wrapped_around | ( | const QuaternionBase< T > & | reference | ) | const |
Methods. Return this quaternions orientation but wrapped around reference.
This means the interpolation between the returned value and reference will always take the shortest path. The angle between them will not be more than pi.
Definition at line 177 of file BLI_math_quaternion.hh.
References BLI_assert, blender::math::distance_squared(), input, blender::math::invert_normalized(), blender::math::is_unit_scale(), len, blender::math::normalize_and_get_length(), QuaternionBase(), result, and T.
Referenced by blender::math::tests::TEST().
|
inlinestatic |
This is just for convenience. Does not represent a rotation as it is degenerate.
Definition at line 65 of file BLI_math_quaternion_types.hh.
Referenced by blender::math::DualQuaternionBase< float >::identity().
|
friend |
Operators.
Definition at line 135 of file BLI_math_quaternion_types.hh.
|
friend |
Definition at line 150 of file BLI_math_quaternion_types.hh.
|
friend |
Definition at line 156 of file BLI_math_quaternion_types.hh.
|
friend |
Definition at line 168 of file BLI_math_quaternion_types.hh.
| T blender::math::QuaternionBase< T >::w |
Definition at line 38 of file BLI_math_quaternion_types.hh.
Referenced by blender::math::angle_of(), blender::math::angle_of_signed(), blender::nodes::node_fn_rotation_to_quaternion_cc::SeparateQuaternionFunction::call(), blender::math::canonicalize(), blender::math::conjugate(), AttributeConverter< blender::math::Quaternion >::convert(), blender::draw::AttributeConverter< math::Quaternion >::convert(), blender::io::usd::detail::convert_value(), blender::io::fbx::create_transform_curve_data(), blender::io::usd::USDPointInstancerWriter::do_write(), blender::math::dot(), ED_view3d_cursor3d_update(), blender::math::detail::from_rotation(), blender::math::detail::from_rotation(), blender::math::is_equal(), blender::math::is_unit_scale(), blender::math::is_zero(), blender::ed::view3d::geometry_nodes_gizmos::matrix_from_position_and_up_direction(), blender::math::detail::normalized_to_quat_fast(), blender::math::QuaternionBase< float >::operator*, blender::math::QuaternionBase< float >::operator*, blender::math::QuaternionBase< float >::operator-, blender::math::pow(), blender::ed::geometry::run_node_group_exec(), blender::bke::bake::serialize_primitive_value(), blender::ed::geometry::store_input_node_values_rna_props(), blender::math::tests::TEST(), blender::math::tests::TEST(), blender::math::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::math::to_axis_angle(), blender::math::to_dual_quaternion(), blender::math::to_quaternion(), blender::math::to_quaternion(), and blender::math::transform_point().
| T blender::math::QuaternionBase< T >::x |
Definition at line 38 of file BLI_math_quaternion_types.hh.
Referenced by blender::nodes::node_fn_rotation_to_quaternion_cc::SeparateQuaternionFunction::call(), blender::math::conjugate(), AttributeConverter< blender::math::Quaternion >::convert(), blender::draw::AttributeConverter< math::Quaternion >::convert(), blender::io::usd::detail::convert_value(), blender::io::fbx::create_transform_curve_data(), blender::io::usd::USDPointInstancerWriter::do_write(), blender::math::dot(), blender::math::detail::from_rotation(), blender::math::detail::from_rotation(), blender::math::is_equal(), blender::math::is_unit_scale(), blender::math::is_zero(), blender::math::detail::normalized_to_quat_fast(), blender::math::QuaternionBase< float >::operator*, blender::math::QuaternionBase< float >::operator*, blender::math::QuaternionBase< float >::operator-, blender::math::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::math::to_axis_angle(), blender::math::to_dual_quaternion(), blender::math::to_quaternion(), blender::math::to_quaternion(), and blender::math::transform_point().
| T blender::math::QuaternionBase< T >::y |
Definition at line 38 of file BLI_math_quaternion_types.hh.
Referenced by blender::nodes::node_fn_rotation_to_quaternion_cc::SeparateQuaternionFunction::call(), blender::math::conjugate(), AttributeConverter< blender::math::Quaternion >::convert(), blender::draw::AttributeConverter< math::Quaternion >::convert(), blender::io::usd::detail::convert_value(), blender::io::fbx::create_transform_curve_data(), blender::io::usd::USDPointInstancerWriter::do_write(), blender::math::dot(), blender::math::detail::from_rotation(), blender::math::detail::from_rotation(), blender::math::is_equal(), blender::math::is_unit_scale(), blender::math::is_zero(), blender::math::detail::normalized_to_quat_fast(), blender::math::QuaternionBase< float >::operator*, blender::math::QuaternionBase< float >::operator*, blender::math::QuaternionBase< float >::operator-, blender::math::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::math::to_axis_angle(), blender::math::to_dual_quaternion(), blender::math::to_quaternion(), blender::math::to_quaternion(), and blender::math::transform_point().
| T blender::math::QuaternionBase< T >::z |
Definition at line 38 of file BLI_math_quaternion_types.hh.
Referenced by blender::nodes::node_fn_rotation_to_quaternion_cc::SeparateQuaternionFunction::call(), blender::math::conjugate(), AttributeConverter< blender::math::Quaternion >::convert(), blender::draw::AttributeConverter< math::Quaternion >::convert(), blender::io::usd::detail::convert_value(), blender::io::fbx::create_transform_curve_data(), blender::io::usd::USDPointInstancerWriter::do_write(), blender::math::dot(), blender::math::detail::from_rotation(), blender::math::detail::from_rotation(), blender::math::is_equal(), blender::math::is_unit_scale(), blender::math::is_zero(), blender::math::detail::normalized_to_quat_fast(), blender::math::QuaternionBase< float >::operator*, blender::math::QuaternionBase< float >::operator*, blender::math::QuaternionBase< float >::operator-, blender::math::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::math::to_axis_angle(), blender::math::to_dual_quaternion(), blender::math::to_quaternion(), blender::math::to_quaternion(), and blender::math::transform_point().