|
Blender V4.5
|
#include "BLI_math_base.h"#include "BLI_math_constants.h"#include "BLI_utildefines.h"#include "DNA_vec_types.h"Go to the source code of this file.
Functions | |
Axis Angle | |
| void | axis_angle_normalized_to_quat (float r[4], const float axis[3], float angle) |
| void | axis_angle_to_quat (float r[4], const float axis[3], float angle) |
| void | axis_angle_to_mat3 (float R[3][3], const float axis[3], float angle) |
| void | axis_angle_normalized_to_mat3_ex (float mat[3][3], const float axis[3], float angle_sin, float angle_cos) |
| void | axis_angle_normalized_to_mat3 (float R[3][3], const float axis[3], float angle) |
| void | axis_angle_to_mat4 (float R[4][4], const float axis[3], float angle) |
| void | mat3_normalized_to_axis_angle (float axis[3], float *angle, const float mat[3][3]) |
| void | mat4_normalized_to_axis_angle (float axis[3], float *angle, const float mat[4][4]) |
| void | mat3_to_axis_angle (float axis[3], float *angle, const float mat[3][3]) |
| void | mat4_to_axis_angle (float axis[3], float *angle, const float mat[4][4]) |
| void | quat_to_axis_angle (float axis[3], float *angle, const float q[4]) |
| void | angle_to_mat2 (float R[2][2], float angle) |
| void | axis_angle_to_mat3_single (float R[3][3], char axis, float angle) |
| void | axis_angle_to_mat4_single (float R[4][4], char axis, float angle) |
| void | axis_angle_to_quat_single (float q[4], char axis, float angle) |
Exponential Map | |
| void | quat_to_expmap (float expmap[3], const float q[4]) |
| void | quat_normalized_to_expmap (float expmap[3], const float q[4]) |
| void | expmap_to_quat (float r[4], const float expmap[3]) |
XYZ Eulers | |
| void | eul_to_quat (float quat[4], const float eul[3]) |
| void | eul_to_mat3 (float mat[3][3], const float eul[3]) |
| void | eul_to_mat4 (float mat[4][4], const float eul[3]) |
| void | mat3_normalized_to_eul (float eul[3], const float mat[3][3]) |
| void | mat4_normalized_to_eul (float eul[3], const float m[4][4]) |
| void | mat3_to_eul (float eul[3], const float mat[3][3]) |
| void | mat4_to_eul (float eul[3], const float mat[4][4]) |
| void | quat_to_eul (float eul[3], const float quat[4]) |
| void | mat3_normalized_to_compatible_eul (float eul[3], const float oldrot[3], float mat[3][3]) |
| void | mat3_to_compatible_eul (float eul[3], const float oldrot[3], float mat[3][3]) |
| void | quat_to_compatible_eul (float eul[3], const float oldrot[3], const float quat[4]) |
| void | rotate_eul (float beul[3], char axis, float angle) |
| void | compatible_eul (float eul[3], const float oldrot[3]) |
| void | add_eul_euleul (float r_eul[3], float a[3], float b[3], short order) |
| void | sub_eul_euleul (float r_eul[3], float a[3], float b[3], short order) |
Dual Quaternions | |
| void | copy_dq_dq (DualQuat *r, const DualQuat *dq) |
| void | normalize_dq (DualQuat *dq, float totweight) |
| void | add_weighted_dq_dq (DualQuat *dq_sum, const DualQuat *dq, float weight) |
| void | add_weighted_dq_dq_pivot (DualQuat *dq_sum, const DualQuat *dq, const float pivot[3], float weight, bool compute_scale_matrix) |
| void | mul_v3m3_dq (float r[3], float R[3][3], DualQuat *dq) |
| void | mat4_to_dquat (DualQuat *dq, const float basemat[4][4], const float mat[4][4]) |
| void | dquat_to_mat4 (float R[4][4], const DualQuat *dq) |
| void | quat_apply_track (float quat[4], short axis, short upflag) |
| void | vec_apply_track (float vec[3], short axis) |
| float | focallength_to_fov (float focal_length, float sensor) |
| float | fov_to_focallength (float hfov, float sensor) |
| float | angle_wrap_rad (float angle) |
| float | angle_wrap_deg (float angle) |
| float | angle_compat_rad (float angle, float angle_compat) |
| bool | mat3_from_axis_conversion (int src_forward, int src_up, int dst_forward, int dst_up, float r_mat[3][3]) |
| bool | mat3_from_axis_conversion_single (int src_axis, int dst_axis, float r_mat[3][3]) |
Quaternions | |
Stored in (w, x, y, z) order. | |
| #define | print_qt_id(q) |
| void | unit_axis_angle (float axis[3], float *angle) |
| void | unit_qt (float q[4]) |
| void | copy_qt_qt (float q[4], const float a[4]) |
| void | mul_qt_qtqt (float q[4], const float a[4], const float b[4]) |
| void | mul_qt_v3 (const float q[4], float r[3]) |
| void | mul_qt_fl (float q[4], float f) |
| void | pow_qt_fl_normalized (float q[4], float fac) |
| void | sub_qt_qtqt (float q[4], const float a[4], const float b[4]) |
| void | invert_qt (float q[4]) |
| void | invert_qt_qt (float q1[4], const float q2[4]) |
| void | invert_qt_normalized (float q[4]) |
| void | invert_qt_qt_normalized (float q1[4], const float q2[4]) |
| void | conjugate_qt (float q[4]) |
| void | conjugate_qt_qt (float q1[4], const float q2[4]) |
| float | dot_qtqt (const float a[4], const float b[4]) |
| float | normalize_qt (float q[4]) |
| float | normalize_qt_qt (float r[4], const float q[4]) |
| bool | is_zero_qt (const float q[4]) |
| void | interp_dot_slerp (float t, float cosom, float r_w[2]) |
| void | interp_qt_qtqt (float q[4], const float a[4], const float b[4], float t) |
| void | add_qt_qtqt (float q[4], const float a[4], const float b[4], float t) |
| void | quat_to_mat3 (float m[3][3], const float q[4]) |
| void | quat_to_mat4 (float m[4][4], const float q[4]) |
| void | quat_to_compatible_quat (float q[4], const float a[4], const float old[4]) |
| void | mat3_normalized_to_quat_fast (float q[4], const float mat[3][3]) |
| void | mat3_normalized_to_quat (float q[4], const float mat[3][3]) |
| void | mat4_normalized_to_quat (float q[4], const float mat[4][4]) |
| void | mat3_to_quat (float q[4], const float mat[3][3]) |
| void | mat4_to_quat (float q[4], const float mat[4][4]) |
| void | tri_to_quat_ex (float quat[4], const float v1[3], const float v2[3], const float v3[3], const float no_orig[3]) |
| float | tri_to_quat (float q[4], const float a[3], const float b[3], const float c[3]) |
| void | vec_to_quat (float q[4], const float vec[3], short axis, short upflag) |
| void | rotation_between_vecs_to_mat3 (float m[3][3], const float v1[3], const float v2[3]) |
| void | rotation_between_vecs_to_quat (float q[4], const float v1[3], const float v2[3]) |
| void | rotation_between_quats_to_quat (float q[4], const float q1[4], const float q2[4]) |
| float | quat_split_swing_and_twist (const float q_in[4], int axis, float r_swing[4], float r_twist[4]) |
| float | angle_normalized_qt (const float q[4]) |
| float | angle_normalized_qtqt (const float q1[4], const float q2[4]) |
| float | angle_qt (const float q[4]) |
| float | angle_qtqt (const float q1[4], const float q2[4]) |
| float | angle_signed_normalized_qt (const float q[4]) |
| float | angle_signed_normalized_qtqt (const float q1[4], const float q2[4]) |
| float | angle_signed_qt (const float q[4]) |
| float | angle_signed_qtqt (const float q1[4], const float q2[4]) |
| void | mat3_to_quat_legacy (float q[4], const float wmat[3][3]) |
| void | sin_cos_from_fraction (int numerator, int denominator, float *r_sin, float *r_cos) |
| void | print_qt (const char *str, const float q[4]) |
Arbitrary Order Eulers | |
| enum | eEulerRotationOrders { EULER_ORDER_DEFAULT = 1 , EULER_ORDER_XYZ = 1 , EULER_ORDER_XZY , EULER_ORDER_YXZ , EULER_ORDER_YZX , EULER_ORDER_ZXY , EULER_ORDER_ZYX } |
| typedef enum eEulerRotationOrders | eEulerRotationOrders |
| void | eulO_to_quat (float q[4], const float e[3], short order) |
| void | eulO_to_mat3 (float M[3][3], const float e[3], short order) |
| void | eulO_to_mat4 (float mat[4][4], const float e[3], short order) |
| void | eulO_to_axis_angle (float axis[3], float *angle, const float eul[3], short order) |
| void | eulO_to_gimbal_axis (float gmat[3][3], const float eul[3], short order) |
| void | mat3_normalized_to_eulO (float eul[3], short order, const float m[3][3]) |
| void | mat4_normalized_to_eulO (float eul[3], short order, const float m[4][4]) |
| void | mat3_to_eulO (float eul[3], short order, const float m[3][3]) |
| void | mat4_to_eulO (float eul[3], short order, const float m[4][4]) |
| void | quat_to_eulO (float e[3], short order, const float q[4]) |
| void | axis_angle_to_eulO (float eul[3], short order, const float axis[3], float angle) |
| void | mat3_normalized_to_compatible_eulO (float eul[3], const float oldrot[3], short order, const float mat[3][3]) |
| void | mat4_normalized_to_compatible_eulO (float eul[3], const float oldrot[3], short order, const float mat[4][4]) |
| void | mat3_to_compatible_eulO (float eul[3], const float oldrot[3], short order, const float mat[3][3]) |
| void | mat4_to_compatible_eulO (float eul[3], const float oldrot[3], short order, const float mat[4][4]) |
| void | quat_to_compatible_eulO (float eul[3], const float oldrot[3], short order, const float quat[4]) |
| void | rotate_eulO (float beul[3], short order, char axis, float angle) |
| #define print_qt_id | ( | q | ) |
Definition at line 195 of file BLI_math_rotation.h.
| enum eEulerRotationOrders |
| Enumerator | |
|---|---|
| EULER_ORDER_DEFAULT | |
| EULER_ORDER_XYZ | |
| EULER_ORDER_XZY | |
| EULER_ORDER_YXZ | |
| EULER_ORDER_YZX | |
| EULER_ORDER_ZXY | |
| EULER_ORDER_ZYX | |
Definition at line 314 of file BLI_math_rotation.h.
| void add_eul_euleul | ( | float | r_eul[3], |
| float | a[3], | ||
| float | b[3], | ||
| short | order ) |
Definition at line 1933 of file math_rotation_c.cc.
References b, eulO_to_quat(), mul_qt_qtqt(), and quat_to_eulO().
Referenced by blender::ed::transform::ElementRotation_ex().
| void add_qt_qtqt | ( | float | q[4], |
| const float | a[4], | ||
| const float | b[4], | ||
| float | t ) |
Definition at line 2061 of file math_rotation_c.cc.
References add_m4_m4m4(), copy_m4_m4(), dot_qtqt(), mul_m4_fl(), DualQuat::quat, DualQuat::scale, DualQuat::scale_weight, and DualQuat::trans.
Referenced by add_weighted_dq_dq_pivot().
| void add_weighted_dq_dq_pivot | ( | DualQuat * | dq_sum, |
| const DualQuat * | dq, | ||
| const float | pivot[3], | ||
| float | weight, | ||
| bool | compute_scale_matrix ) |
Add the transformation defined by the given dual quaternion to the accumulator, using the specified pivot point for combining scale transformations.
Definition at line 2100 of file math_rotation_c.cc.
References add_weighted_dq_dq(), mul_v3_m4v3(), DualQuat::quat, DualQuat::scale, DualQuat::scale_weight, sub_v3_v3(), and DualQuat::trans.
Referenced by armdef_accumulate_matrix(), and pchan_deform_accumulate().
| float angle_compat_rad | ( | float | angle, |
| float | angle_compat ) |
Returns an angle compatible with angle_compat.
Definition at line 2332 of file math_rotation_c.cc.
References angle(), and angle_wrap_rad().
Referenced by gizmo_bisect_prop_angle_set(), gizmo_spin_prop_axis_angle_set(), and blender::ed::transform::recalcData_edit_armature().
| float angle_normalized_qt | ( | const float | q[4] | ) |
Definition at line 620 of file math_rotation_c.cc.
References BLI_ASSERT_UNIT_QUAT, and safe_acosf().
Referenced by angle_normalized_qtqt(), angle_qt(), and ED_view3d_cursor3d_position_rotation().
| float angle_normalized_qtqt | ( | const float | q1[4], |
| const float | q2[4] ) |
Definition at line 635 of file math_rotation_c.cc.
References angle_normalized_qt(), BLI_ASSERT_UNIT_QUAT, and rotation_between_quats_to_quat().
Referenced by angle_qtqt(), and angle_signed_normalized_qtqt().
| float angle_qt | ( | const float | q[4] | ) |
Definition at line 626 of file math_rotation_c.cc.
References angle_normalized_qt(), and normalize_qt_qt().
| float angle_qtqt | ( | const float | q1[4], |
| const float | q2[4] ) |
Definition at line 647 of file math_rotation_c.cc.
References angle_normalized_qtqt(), and normalize_qt_qt().
Referenced by angle_signed_qtqt().
| float angle_signed_normalized_qt | ( | const float | q[4] | ) |
Definition at line 669 of file math_rotation_c.cc.
References BLI_ASSERT_UNIT_QUAT, and safe_acosf().
Referenced by angle_signed_qt().
| float angle_signed_normalized_qtqt | ( | const float | q1[4], |
| const float | q2[4] ) |
Definition at line 679 of file math_rotation_c.cc.
References angle_normalized_qtqt(), dot_qtqt(), and negate_v4_v4().
Referenced by ED_view3d_smooth_view_ex().
| float angle_signed_qt | ( | const float | q[4] | ) |
Definition at line 690 of file math_rotation_c.cc.
References angle_signed_normalized_qt(), and normalize_qt_qt().
| float angle_signed_qtqt | ( | const float | q1[4], |
| const float | q2[4] ) |
Definition at line 699 of file math_rotation_c.cc.
References angle_qtqt(), dot_qtqt(), and negate_v4_v4().
Referenced by ED_view3d_quat_to_axis_view(), and view_axis_exec().
| void angle_to_mat2 | ( | float | R[2][2], |
| float | angle ) |
Definition at line 1277 of file math_rotation_c.cc.
References angle(), cosf, R, and sinf.
Referenced by C_Matrix_Rotation(), compensate_rotation_center(), init_track_for_stabilization(), blender::geometry::p_chart_rotate_fit_aabb(), and stitch_calculate_island_snapping().
| float angle_wrap_deg | ( | float | angle | ) |
Definition at line 2327 of file math_rotation_c.cc.
References angle(), and mod_inline().
| float angle_wrap_rad | ( | float | angle | ) |
Definition at line 2322 of file math_rotation_c.cc.
References angle(), M_PI, and mod_inline().
Referenced by angle_compat_rad(), C_Matrix_Rotation(), dial_ghostarc_get_angles(), expmap_to_quat(), Quaternion_angle_set(), Quaternion_new(), update_duplicate_kinematics_constraint_settings(), and viewrotate_apply().
| void axis_angle_normalized_to_mat3 | ( | float | R[3][3], |
| const float | axis[3], | ||
| float | angle ) |
Definition at line 1159 of file math_rotation_c.cc.
References angle(), axis_angle_normalized_to_mat3_ex(), cosf, R, and sinf.
Referenced by blender::ed::transform::applyNormalRotation(), blender::ed::transform::applyRotationMatrix(), blender::ed::transform::applyTrackballMatrix(), blender::ed::transform::applyTrackballValue(), axis_angle_to_mat3(), bmo_spin_exec(), blender::io::usd::convert_to_z_up(), damptrack_do_transform(), do_kink_spiral(), do_kink_spiral_deform(), gizmo_bisect_prop_angle_set(), gizmo_spin_prop_axis_angle_set(), legacy_vec_roll_to_mat3_normalized(), modify_mesh(), blender::ed::transform::rmat_cache_init(), blender::ed::transform::rmat_cache_update(), blender::math::rotate_around_axis(), blender::ed::transform::transdata_elem_bend(), blender::ed::transform::transdata_elem_rotate(), blender::ed::transform::transdata_elem_trackball(), vec_roll_to_mat3_normalized(), and wm_xr_fly_compute_turn().
| void axis_angle_normalized_to_mat3_ex | ( | float | mat[3][3], |
| const float | axis[3], | ||
| float | angle_sin, | ||
| float | angle_cos ) |
axis angle to 3x3 matrix
This takes the angle with sin/cos applied so we can avoid calculating it in some cases.
| axis | rotation axis (must be normalized). |
| angle_sin | sin(angle) |
| angle_cos | cos(angle) |
Definition at line 1124 of file math_rotation_c.cc.
References BLI_ASSERT_UNIT_V3.
Referenced by axis_angle_normalized_to_mat3(), and rotation_between_vecs_to_mat3().
| void axis_angle_normalized_to_quat | ( | float | r[4], |
| const float | axis[3], | ||
| float | angle ) |
Definition at line 1051 of file math_rotation_c.cc.
References angle(), BLI_ASSERT_UNIT_V3, cosf, mul_v3_v3fl(), and sinf.
Referenced by axis_angle_to_quat(), expmap_to_quat(), flip_qt_qt(), rotation_between_vecs_to_quat(), blender::ed::sculpt_paint::pose::solve_roll_chain(), vec_to_quat(), and view_roll_angle().
| void axis_angle_to_eulO | ( | float | eul[3], |
| short | order, | ||
| const float | axis[3], | ||
| float | angle ) |
Axis Angle to Euler Rotation.
Definition at line 1106 of file math_rotation_c.cc.
References angle(), axis_angle_to_quat(), and quat_to_eulO().
Referenced by BKE_rotMode_change_values(), blender::ed::object::object_clear_rot(), pchan_clear_rot(), pose_bone_do_paste(), and blender::ed::transform::protectedAxisAngleBits().
| void axis_angle_to_mat3 | ( | float | R[3][3], |
| const float | axis[3], | ||
| float | angle ) |
Axis angle to 3x3 matrix - safer version (normalization of axis performed).
Definition at line 1164 of file math_rotation_c.cc.
References angle(), axis_angle_normalized_to_mat3(), nor, normalize_v3_v3(), R, and unit_m3().
Referenced by blender::nodes::node_fn_align_euler_to_vector_cc::align_rotations_auto_pivot(), blender::nodes::node_fn_align_euler_to_vector_cc::align_rotations_fixed_pivot(), axis_angle_to_mat4(), BKE_object_rot_to_mat3(), BKE_pchan_rot_to_mat3(), bmo_create_uvsphere_exec(), C_Matrix_Rotation(), ed_editnurb_spin(), ED_view3d_cursor3d_update(), edbm_dupli_extrude_cursor_invoke(), blender::nodes::node_fn_rotate_euler_cc::get_multi_function(), gizmo_mesh_spin_init_refresh(), joint_callback(), blender::nodes::node_geo_curve_primitive_arc_cc::rotate_vector_around_axis(), blender::nodes::node_shader_vector_rotate_cc::sh_node_vector_rotate_around_axis(), splineik_evaluate_bone(), blender::ed::transform::transform_data_ext_rotate(), and View3DCursor::matrix< blender::float3x3 >().
| void axis_angle_to_mat3_single | ( | float | R[3][3], |
| char | axis, | ||
| float | angle ) |
Create a 3x3 rotation matrix from a single axis.
Definition at line 1232 of file math_rotation_c.cc.
References angle(), BLI_assert_unreachable, cosf, R, and sinf.
Referenced by axis_angle_to_mat4_single(), C_Matrix_Rotation(), calc_overlap(), blender::ed::transform::gizmo2d_xform_invoke_prepare(), blender::ed::space_node::gizmo_node_box_mask_prop_matrix_get(), modify_mesh(), blender::ed::transform::SeqToTransData(), and blender::ed::transform::transform_orientation_matrix_get().
| void axis_angle_to_mat4 | ( | float | R[4][4], |
| const float | axis[3], | ||
| float | angle ) |
Axis angle to 4x4 matrix - safer version (normalization of axis performed).
Definition at line 1177 of file math_rotation_c.cc.
References angle(), axis_angle_to_mat3(), copy_m4_m3(), R, and unit_m4().
Referenced by blender::ed::transform::constraintob_from_transdata(), TransformReader::dae_rotate_to_mat4(), AnimationImporter::evaluate_animation(), and GPU_matrix_rotate_3fv().
| void axis_angle_to_mat4_single | ( | float | R[4][4], |
| char | axis, | ||
| float | angle ) |
Create a 4x4 rotation matrix from a single axis.
Definition at line 1225 of file math_rotation_c.cc.
References angle(), axis_angle_to_mat3_single(), copy_m4_m3(), and R.
Referenced by blender::io::alembic::ABCTransformWriter::do_write(), blender::workbench::get_world_shading_rotation_matrix(), lookat_m4(), make_duplis_font(), blender::ed::object::object_warp_calc_view_matrix(), blender::io::alembic::AbcObjectReader::read_matrix(), blender::io::alembic::AbcObjectReader::setupObjectTransform(), and UnitConverter::UnitConverter().
| void axis_angle_to_quat | ( | float | r[4], |
| const float | axis[3], | ||
| float | angle ) |
Definition at line 1061 of file math_rotation_c.cc.
References angle(), axis_angle_normalized_to_quat(), LIKELY, nor, normalize_v3_v3(), and unit_qt().
Referenced by axis_angle_to_eulO(), blender::ed::transform::axis_angle_to_gimbal_axis(), basic_rotate(), bevel_list_apply_tilt(), bevel_list_smooth(), BKE_object_mat3_to_rot(), BKE_rotMode_change_values(), bm_edgering_pair_interpolate(), boid_body(), cache_key_incremental_rotation(), TransformReader::dae_rotate_to_mat4(), do_guides(), do_kink(), blender::ed::transform::ElementRotation_ex(), flyApply(), gizmo_ruler_draw(), knifetool_draw_angle(), make_bevel_list_3D_minimum_twist(), make_bevel_list_segment_3D(), minimum_twist_between_two_points(), modify_mesh(), pose_bone_do_paste(), psys_get_birth_coords(), psys_get_dupli_path_transform(), Quaternion_angle_set(), Quaternion_axis_vector_set(), Quaternion_new(), rotation_between_vecs_to_quat(), blender::ed::object::rotation_from_quat(), view_axis_exec(), vieworbit_exec(), viewrotate_apply(), viewrotate_apply_snap(), and walkApply().
| void axis_angle_to_quat_single | ( | float | q[4], |
| char | axis, | ||
| float | angle ) |
Definition at line 1289 of file math_rotation_c.cc.
References angle(), BLI_assert, cosf, sinf, and zero_v3().
Referenced by vieworbit_exec(), viewrotate_apply(), walkApply(), wm_xr_basenav_rotation_calc(), and wm_xr_session_base_pose_calc().
| void compatible_eul | ( | float | eul[3], |
| const float | oldrot[3] ) |
Manipulate eul so it's close to oldrot while representing the same rotation with the aim of having the minimum difference between all axes.
This is typically done so interpolating the values between two euler rotations doesn't add undesired rotation (even rotating multiple times around one axis).
Definition at line 1514 of file math_rotation_c.cc.
References fabsf, floorf, i, M_PI, and M_PI_2.
Referenced by dvar_eval_transChan(), Euler_make_compatible(), mat3_normalized_to_compatible_eul(), mat3_normalized_to_compatible_eulO(), and rotlike_evaluate().
| void conjugate_qt | ( | float | q[4] | ) |
Definition at line 99 of file math_rotation_c.cc.
Referenced by invert_qt(), invert_qt_normalized(), and Quaternion_conjugate().
| void conjugate_qt_qt | ( | float | q1[4], |
| const float | q2[4] ) |
Definition at line 91 of file math_rotation_c.cc.
Referenced by rotation_between_quats_to_quat().
Definition at line 2221 of file math_rotation_c.cc.
| void copy_qt_qt | ( | float | q[4], |
| const float | a[4] ) |
Definition at line 47 of file math_rotation_c.cc.
Referenced by blender::ed::transform::add_pose_transdata(), bevel_list_smooth(), BKE_object_tfm_backup(), BKE_object_tfm_restore(), BKE_pose_copy_pchan_result(), BKE_screen_view3d_do_versions_250(), BKE_where_on_path(), blo_update_defaults_screen(), bm_edgering_pair_interpolate(), boid_body(), calc_curve_deform(), blender::ed::transform::createTransCursor_view3d(), blender::ed::transform::createTransMBallVerts(), blender::ed::transform::createTransSculpt(), do_path_effectors(), blender::ed::sculpt_paint::pose::do_pose_brush(), dquat_to_mat4(), ED_view3d_cameracontrol_acquire(), ED_view3d_cameracontrol_release(), ED_view3d_cursor3d_position_rotation(), ED_view3d_cursor3d_update(), ED_view3d_lastview_store(), ED_view3d_quat_from_axis_view(), ED_view3d_smooth_view_ex(), fcurves_to_pchan_links_get(), ViewOpsData::init_navigation(), interp_qt_qtqt(), interpolate_pathcache(), invert_qt_qt(), invert_qt_qt_normalized(), blender::ed::object::metaball_coords_and_quats_apply_with_mat4(), blender::ed::object::metaball_coords_and_quats_get(), minimum_twist_between_two_points(), modify_mesh(), normalize_qt_qt(), blender::ed::object::object_clear_rot(), blender::ed::transform::ObjectToTransData(), offset_child(), pose_bone_do_paste(), blender::ed::transform::pose_mirror_info_init(), blender::ed::transform::pose_mirror_info_restore(), pose_slide_apply_quat(), poseAnim_mapping_reset(), psys_cache_edit_paths_iter(), psys_cache_paths(), psys_get_birth_coords(), psys_get_from_key(), psys_get_particle_on_path(), psys_path_iter_get(), psys_thread_create_path(), quat_mul_float(), quat_to_compatible_quat(), Quaternion_CreatePyObject(), Quaternion_imatmul(), blender::ed::transform::restoreElement(), rotateBevelPiece(), blender::ed::object::rotation_from_view(), ViewOpsData::state_backup(), ViewOpsData::state_restore(), blender::ed::transform::transform_data_ext_rotate(), view3d_localview_update_rv3d(), view3d_smooth_view_state_backup(), view3d_smooth_view_state_restore(), viewrotate_apply(), viewrotate_apply_snap(), WM_xr_action_binding_create(), WM_xr_action_state_get(), wm_xr_draw_matrices_create(), wm_xr_navigation_fly_modal(), wm_xr_session_event_create(), WM_xr_session_state_controller_aim_rotation_get(), WM_xr_session_state_controller_grip_rotation_get(), WM_xr_session_state_nav_rotation_get(), WM_xr_session_state_nav_rotation_set(), and wm_xr_session_state_update().
| float dot_qtqt | ( | const float | a[4], |
| const float | b[4] ) |
Definition at line 106 of file math_rotation_c.cc.
References b.
Referenced by add_weighted_dq_dq(), angle_signed_normalized_qtqt(), angle_signed_qtqt(), dquat_to_mat4(), interp_qt_qtqt(), invert_qt(), mat3_normalized_to_quat_fast(), mul_v3m3_dq(), normalize_qt(), quat_to_axis_angle(), quat_to_mat3(), quat_to_mat4(), Quaternion_dot(), Quaternion_magnitude_get(), rotation_between_quats_to_quat(), and TEST().
| void dquat_to_mat4 | ( | float | R[4][4], |
| const DualQuat * | dq ) |
Definition at line 2031 of file math_rotation_c.cc.
References copy_qt_qt(), dot_qtqt(), len, mul_m4_m4m4(), mul_qt_fl(), DualQuat::quat, quat_to_mat4(), R, DualQuat::scale, DualQuat::scale_weight, sqrtf, and DualQuat::trans.
Referenced by armdef_evaluate().
| void eul_to_mat3 | ( | float | mat[3][3], |
| const float | eul[3] ) |
Definition at line 1340 of file math_rotation_c.cc.
Referenced by blender::nodes::node_fn_align_euler_to_vector_cc::align_rotations_auto_pivot(), blender::nodes::node_fn_align_euler_to_vector_cc::align_rotations_fixed_pivot(), euler_filter_multi_channel(), blender::nodes::node_fn_rotate_euler_cc::get_multi_function(), loc_eul_size_to_mat4(), blender::ed::object::new_primitive_matrix(), object_preview_camera_create(), rotate_eul(), blender::nodes::node_shader_vector_rotate_cc::sh_node_vector_rotate_euler(), and blender::bke::tests::TEST().
| void eul_to_mat4 | ( | float | mat[4][4], |
| const float | eul[3] ) |
Definition at line 1366 of file math_rotation_c.cc.
Referenced by BKE_texture_mapping_init().
| void eul_to_quat | ( | float | quat[4], |
| const float | eul[3] ) |
Definition at line 1465 of file math_rotation_c.cc.
Referenced by modify_mesh(), blender::ed::object::object_clear_rot(), pchan_clear_rot(), pose_bone_do_paste(), blender::ed::transform::protectedQuaternionBits(), and wm_xr_session_base_pose_calc().
| void eulO_to_axis_angle | ( | float | axis[3], |
| float * | angle, | ||
| const float | eul[3], | ||
| short | order ) |
Euler Rotation to Axis Angle.
Definition at line 1115 of file math_rotation_c.cc.
References angle(), eulO_to_quat(), and quat_to_axis_angle().
Referenced by BKE_rotMode_change_values(), blender::ed::object::object_clear_rot(), pchan_clear_rot(), pose_bone_do_paste(), and blender::ed::transform::protectedAxisAngleBits().
| void eulO_to_gimbal_axis | ( | float | gmat[3][3], |
| const float | eul[3], | ||
| short | order ) |
The matrix is written to as 3 axis vectors.
Definition at line 1911 of file math_rotation_c.cc.
References copy_v3_v3(), eulO_to_mat3(), get_rotation_order_info(), R, and zero_v3().
Referenced by blender::ed::transform::gimbal_axis_object(), and blender::ed::transform::gimbal_axis_pose().
| void eulO_to_mat3 | ( | float | M[3][3], |
| const float | e[3], | ||
| short | order ) |
Construct 3x3 matrix from Euler angles (in radians).
Definition at line 1684 of file math_rotation_c.cc.
References cos, e, get_rotation_order_info(), i, M, R, and sin.
Referenced by BKE_object_rot_to_mat3(), BKE_pchan_rot_to_mat3(), draw_bone_update_disp_matrix_custom_shape(), blender::ed::transform::ElementRotation_ex(), Euler_rotate(), Euler_to_matrix(), eulO_to_gimbal_axis(), eulO_to_mat4(), joint_callback(), loc_eulO_size_to_mat4(), mathutils_any_to_rotmat(), rotate_eulO(), rotlike_evaluate(), blender::ed::transform::transform_data_ext_rotate(), transform_evaluate(), and View3DCursor::matrix< blender::float3x3 >().
| void eulO_to_mat4 | ( | float | mat[4][4], |
| const float | e[3], | ||
| short | order ) |
Construct 4x4 matrix from Euler angles (in radians).
Definition at line 1761 of file math_rotation_c.cc.
References copy_m4_m3(), e, and eulO_to_mat3().
Referenced by BKE_pchan_minmax(), C_Matrix_LocRotScale(), and blender::ed::transform::constraintob_from_transdata().
| void eulO_to_quat | ( | float | q[4], |
| const float | e[3], | ||
| short | order ) |
Construct quaternion from Euler angles (in radians).
Definition at line 1639 of file math_rotation_c.cc.
References cos, e, get_rotation_order_info(), i, R, and sin.
Referenced by add_eul_euleul(), BKE_object_mat3_to_rot(), BKE_rotMode_change_values(), Euler_to_quaternion(), eulO_to_axis_angle(), mapping_node_order_flip(), pose_bone_do_paste(), and sub_eul_euleul().
| void expmap_to_quat | ( | float | r[4], |
| const float | expmap[3] ) |
Definition at line 1324 of file math_rotation_c.cc.
References angle(), angle_wrap_rad(), axis_angle_normalized_to_quat(), LIKELY, normalize_v3_v3(), and unit_qt().
Referenced by Quaternion_new().
| float focallength_to_fov | ( | float | focal_length, |
| float | sensor ) |
Lens/angle conversion (radians).
Definition at line 2306 of file math_rotation_c.cc.
References atanf.
Referenced by BKE_uvproject_camera_info(), ED_view3d_radius_to_dist(), AnimationExporter::get_modified_export_curve(), lineart_main_load_geometries(), and CamerasExporter::operator()().
| float fov_to_focallength | ( | float | hfov, |
| float | sensor ) |
Definition at line 2311 of file math_rotation_c.cc.
References tanf.
Referenced by AnimationImporter::convert_to_focal_length(), wm_xr_session_state_update(), and DocumentImporter::writeCamera().
| void interp_dot_slerp | ( | float | t, |
| float | cosom, | ||
| float | r_w[2] ) |
Generic function for implementing slerp (quaternions and spherical vector coords).
| t | factor in [0..1] |
| cosom | dot product from normalized vectors/quats. |
| r_w | calculated weights. |
Definition at line 868 of file math_rotation_c.cc.
References acosf, BLI_assert, eps, fabsf, IN_RANGE_INCL, LIKELY, and sinf.
Referenced by interp_qt_qtqt(), interp_v3_v3v3_slerp(), and Vector_slerp().
| void interp_qt_qtqt | ( | float | q[4], |
| const float | a[4], | ||
| const float | b[4], | ||
| float | t ) |
Definition at line 890 of file math_rotation_c.cc.
References b, BLI_ASSERT_UNIT_QUAT, copy_qt_qt(), dot_qtqt(), interp_dot_slerp(), negate_v4_v4(), and w().
Referenced by animsys_blend_fcurves_quaternion(), bevel_list_smooth(), BKE_where_on_path(), blend_m3_m3m3(), blend_m4_m4m4(), collision_response(), do_kink_spiral(), do_particle_interpolation(), execute_posetree(), interp_m3_m3m3(), interpolate_pathcache(), pose_slide_apply_quat(), psys_get_birth_coords(), psys_get_particle_state(), ptcache_particle_interpolate(), ptcache_rigidbody_interpolate(), Quaternion_slerp(), rotateBevelPiece(), and view3d_smoothview_apply_with_interp().
| void invert_qt | ( | float | q[4] | ) |
Definition at line 111 of file math_rotation_c.cc.
References conjugate_qt(), dot_qtqt(), and mul_qt_fl().
Referenced by invert_qt_qt(), and Quaternion_invert().
| void invert_qt_normalized | ( | float | q[4] | ) |
This is just conjugate_qt for cases we know q is unit-length. we could use conjugate_qt directly, but use this function to show intent, and assert if its ever becomes non-unit-length.
Definition at line 129 of file math_rotation_c.cc.
References BLI_ASSERT_UNIT_QUAT, and conjugate_qt().
Referenced by BKE_object_mat3_to_rot(), dvar_eval_rotDiff(), ED_view3d_from_m4(), invert_qt_qt_normalized(), nla_combine_quaternion_get_inverted_lower_values(), nla_combine_quaternion_get_inverted_strip_values(), sub_eul_euleul(), view3d_boxview_sync_axis(), view3d_orbit_apply_dyn_ofs(), view_axis_exec(), and viewrotate_apply_snap().
| void invert_qt_qt | ( | float | q1[4], |
| const float | q2[4] ) |
Definition at line 123 of file math_rotation_c.cc.
References copy_qt_qt(), and invert_qt().
| void invert_qt_qt_normalized | ( | float | q1[4], |
| const float | q2[4] ) |
Definition at line 135 of file math_rotation_c.cc.
References copy_qt_qt(), and invert_qt_normalized().
Referenced by ED_view3d_distance_set(), ED_view3d_distance_set_from_location(), blender::ed::transform::ElementRotation_ex(), psys_get_birth_coords(), view3d_orbit_apply_dyn_ofs(), view3d_orbit_apply_dyn_ofs_ortho_correction(), viewrotate_apply_snap(), wm_xr_pose_scale_to_imat(), and wm_xr_pose_to_imat().
| bool is_zero_qt | ( | const float | q[4] | ) |
Definition at line 55 of file math_rotation_c.cc.
| bool mat3_from_axis_conversion | ( | int | src_forward, |
| int | src_up, | ||
| int | dst_forward, | ||
| int | dst_up, | ||
| float | r_mat[3][3] ) |
Each argument us an axis in ['X', 'Y', 'Z', '-X', '-Y', '-Z'] where the first 2 are a source and the second 2 are the target.
Definition at line 2420 of file math_rotation_c.cc.
References _axis_convert_lut, _axis_convert_matrix, _axis_signed(), ARRAY_SIZE, copy_m3_m3(), i, and unit_m3().
Referenced by BCMatrix::BCMatrix(), blender::io::usd::USDTransformWriter::do_write(), blender::io::usd::ensure_root_prim(), blender::io::stl::export_frame(), blender::io::ply::importer_main(), blender::io::stl::importer_main(), mat3_from_axis_conversion_single(), meshcache_do(), blender::io::ply::set_world_axes_transform(), blender::math::tests::TEST(), and blender::io::obj::transform_object().
| bool mat3_from_axis_conversion_single | ( | int | src_axis, |
| int | dst_axis, | ||
| float | r_mat[3][3] ) |
Use when the second axis can be guessed.
Definition at line 2453 of file math_rotation_c.cc.
References mat3_from_axis_conversion(), and unit_m3().
Referenced by single_axis_convert(), and blender::math::tests::TEST().
| void mat3_normalized_to_axis_angle | ( | float | axis[3], |
| float * | angle, | ||
| const float | mat[3][3] ) |
3x3 matrix to axis angle.
Definition at line 1186 of file math_rotation_c.cc.
References angle(), mat3_normalized_to_quat(), and quat_to_axis_angle().
Referenced by BKE_pchan_mat3_to_rot(), and pivotcon_evaluate().
| void mat3_normalized_to_compatible_eul | ( | float | eul[3], |
| const float | oldrot[3], | ||
| float | mat[3][3] ) |
Definition at line 1557 of file math_rotation_c.cc.
References compatible_eul(), copy_v3_v3(), fabsf, and mat3_normalized_to_eul2().
Referenced by euler_filter_multi_channel(), mat3_to_compatible_eul(), Matrix_to_euler(), and quat_to_compatible_eul().
| void mat3_normalized_to_compatible_eulO | ( | float | eul[3], |
| const float | oldrot[3], | ||
| short | order, | ||
| const float | mat[3][3] ) |
Definition at line 1812 of file math_rotation_c.cc.
References compatible_eul(), copy_v3_v3(), fabsf, and mat3_normalized_to_eulo2().
Referenced by BKE_pchan_mat3_to_rot(), mat3_to_compatible_eulO(), mat4_normalized_to_compatible_eulO(), mat4_to_compatible_eulO(), Matrix_to_euler(), and quat_to_compatible_eulO().
| void mat3_normalized_to_eul | ( | float | eul[3], |
| const float | mat[3][3] ) |
Definition at line 1422 of file math_rotation_c.cc.
References copy_v3_v3(), fabsf, and mat3_normalized_to_eul2().
Referenced by blender::ed::object::add_generic_get_opts(), mat3_to_eul(), mat4_normalized_to_eul(), Matrix_to_euler(), quat_to_eul(), and view3d_collection_drop_matrix_from_snap().
| void mat3_normalized_to_eulO | ( | float | eul[3], |
| short | order, | ||
| const float | m[3][3] ) |
Convert 3x3 matrix to Euler angles (in radians).
Definition at line 1770 of file math_rotation_c.cc.
References copy_v3_v3(), fabsf, and mat3_normalized_to_eulo2().
Referenced by BKE_pchan_mat3_to_rot(), mat3_to_eulO(), mat4_normalized_to_eulO(), mat4_to_eulO(), Matrix_to_euler(), and quat_to_eulO().
| void mat3_normalized_to_quat | ( | float | q[4], |
| const float | mat[3][3] ) |
Definition at line 392 of file math_rotation_c.cc.
References copy_m3_m3(), and mat3_normalized_to_quat_with_checks().
Referenced by BKE_object_mat3_to_rot(), BKE_pchan_mat3_to_rot(), ED_view3d_from_m4(), mat3_normalized_to_axis_angle(), mat4_to_loc_quat(), snap_selected_to_location_rotation(), TEST(), and test_quat_to_mat_to_quat().
| void mat3_normalized_to_quat_fast | ( | float | q[4], |
| const float | mat[3][3] ) |
A version of mat3_normalized_to_quat that skips error checking.
Definition at line 286 of file math_rotation_c.cc.
References BLI_assert, BLI_ASSERT_UNIT_M3, dot_qtqt(), fabs(), is_negative_m3(), normalize_qt(), sqrtf, and UNLIKELY.
Referenced by blend_m3_m3m3(), blend_m4_m4m4(), mat3_normalized_to_quat_with_checks(), mat4_decompose(), Matrix_decompose(), and TEST().
| void mat3_to_axis_angle | ( | float | axis[3], |
| float * | angle, | ||
| const float | mat[3][3] ) |
Definition at line 1195 of file math_rotation_c.cc.
References angle(), mat3_to_quat(), and quat_to_axis_angle().
Referenced by snap_selected_to_location_rotation(), and blender::ed::transform::transform_data_ext_rotate().
| void mat3_to_compatible_eul | ( | float | eul[3], |
| const float | oldrot[3], | ||
| float | mat[3][3] ) |
Definition at line 1578 of file math_rotation_c.cc.
References mat3_normalized_to_compatible_eul(), and normalize_m3_m3().
| void mat3_to_compatible_eulO | ( | float | eul[3], |
| const float | oldrot[3], | ||
| short | order, | ||
| const float | mat[3][3] ) |
Definition at line 1836 of file math_rotation_c.cc.
References mat3_normalized_to_compatible_eulO(), and normalize_m3_m3().
Referenced by blender::ed::transform::ElementRotation_ex(), Euler_rotate(), and blender::ed::transform::transform_data_ext_rotate().
| void mat3_to_eul | ( | float | eul[3], |
| const float | mat[3][3] ) |
Definition at line 1438 of file math_rotation_c.cc.
References mat3_normalized_to_eul(), and normalize_m3_m3().
Referenced by blender::nodes::node_fn_align_euler_to_vector_cc::align_rotations_auto_pivot(), blender::nodes::node_fn_align_euler_to_vector_cc::align_rotations_fixed_pivot(), blender::io::usd::ensure_root_prim(), blender::nodes::node_fn_rotate_euler_cc::get_multi_function(), mat4_to_eul(), rotate_eul(), and view3d_interactive_add_modal().
| void mat3_to_eulO | ( | float | eul[3], |
| short | order, | ||
| const float | m[3][3] ) |
Definition at line 1788 of file math_rotation_c.cc.
References mat3_normalized_to_eulO(), and normalize_m3_m3().
Referenced by blender::io::alembic::copy_m44_axis_swap(), rotate_eulO(), snap_selected_to_location_rotation(), and transform_evaluate().
| void mat3_to_quat | ( | float | q[4], |
| const float | mat[3][3] ) |
Definition at line 399 of file math_rotation_c.cc.
References mat3_normalized_to_quat_with_checks(), and normalize_m3_m3().
Referenced by ED_view3d_cursor3d_position_rotation(), blender::ed::transform::ElementRotation_ex(), execute_posetree(), interp_m3_m3m3(), mat3_to_axis_angle(), mat3_vec_to_roll(), Matrix_to_quaternion(), modify_mesh(), object_preview_camera_create(), psys_get_birth_coords(), Quaternion_rotate(), blender::ed::transform::transform_data_ext_rotate(), and view_axis_exec().
| void mat3_to_quat_legacy | ( | float | q[4], |
| const float | wmat[3][3] ) |
Legacy matrix to quaternion conversion, keep to prevent changes to existing boids & particle-system behavior. Use mat3_to_quat for new code.
Definition at line 421 of file math_rotation_c.cc.
References angle(), atan2f, copy_m3_m3(), cosf, invert_m3_m3(), mul_m3_v3(), mul_qt_qtqt(), nor, normalize_m3(), normalize_v3(), quat_to_mat3_no_error(), safe_acosf(), and sinf.
Referenced by boid_body(), psys_cache_edit_paths_iter(), psys_cache_paths(), and psys_get_birth_coords().
| void mat4_normalized_to_axis_angle | ( | float | axis[3], |
| float * | angle, | ||
| const float | mat[4][4] ) |
4x4 matrix to axis angle.
Definition at line 1205 of file math_rotation_c.cc.
References angle(), mat4_normalized_to_quat(), and quat_to_axis_angle().
| void mat4_normalized_to_compatible_eulO | ( | float | eul[3], |
| const float | oldrot[3], | ||
| short | order, | ||
| const float | mat[4][4] ) |
Definition at line 1847 of file math_rotation_c.cc.
References copy_m3_m4(), and mat3_normalized_to_compatible_eulO().
| void mat4_normalized_to_eul | ( | float | eul[3], |
| const float | m[4][4] ) |
Definition at line 1445 of file math_rotation_c.cc.
References copy_m3_m4(), and mat3_normalized_to_eul().
| void mat4_normalized_to_eulO | ( | float | eul[3], |
| short | order, | ||
| const float | m[4][4] ) |
Convert 4x4 matrix to Euler angles (in radians).
Definition at line 1795 of file math_rotation_c.cc.
References copy_m3_m4(), and mat3_normalized_to_eulO().
| void mat4_normalized_to_quat | ( | float | q[4], |
| const float | mat[4][4] ) |
Definition at line 406 of file math_rotation_c.cc.
References copy_m3_m4(), and mat3_normalized_to_quat_with_checks().
Referenced by mat4_normalized_to_axis_angle(), and obmat_to_viewmat().
| void mat4_to_axis_angle | ( | float | axis[3], |
| float * | angle, | ||
| const float | mat[4][4] ) |
4x4 matrix to axis angle.
Definition at line 1215 of file math_rotation_c.cc.
References angle(), mat4_to_quat(), and quat_to_axis_angle().
Referenced by blender::ed::transform::constraintRotLim(), and blender::animrig::visualkey_get_values().
| void mat4_to_compatible_eulO | ( | float | eul[3], |
| const float | oldrot[3], | ||
| short | order, | ||
| const float | mat[4][4] ) |
Definition at line 1858 of file math_rotation_c.cc.
References copy_m3_m4(), mat3_normalized_to_compatible_eulO(), and normalize_m3().
Referenced by rotlike_evaluate().
| void mat4_to_dquat | ( | DualQuat * | dq, |
| const float | basemat[4][4], | ||
| const float | mat[4][4] ) |
Definition at line 1972 of file math_rotation_c.cc.
References copy_m3_m4(), copy_m4_m4(), copy_v3_v3(), determinant_m4(), invert_m4_m4(), is_orthonormal_m3(), len_squared_v3(), mat4_to_quat(), mat4_to_size(), mul_m4_m4m4(), mul_m4_series, orthogonalize_m4(), DualQuat::quat, quat_to_mat4(), R, DualQuat::scale, DualQuat::scale_weight, square_f(), and DualQuat::trans.
Referenced by armdef_accumulate_matrix(), BKE_pchan_bbone_segments_cache_compute(), BKE_pose_bone_done(), and blender::math::tests::TEST().
| void mat4_to_eul | ( | float | eul[3], |
| const float | mat[4][4] ) |
Definition at line 1451 of file math_rotation_c.cc.
References copy_m3_m4(), and mat3_to_eul().
Referenced by actcon_get_tarmat(), bc_decompose(), and blender::ed::space_node::gizmo_node_box_mask_prop_matrix_set().
| void mat4_to_eulO | ( | float | eul[3], |
| short | order, | ||
| const float | m[4][4] ) |
Definition at line 1804 of file math_rotation_c.cc.
References copy_m3_m4(), mat3_normalized_to_eulO(), and normalize_m3().
Referenced by BKE_driver_target_matrix_to_rot_channels(), childof_evaluate(), blender::ed::transform::constraintRotLim(), pivotcon_evaluate(), rotlike_evaluate(), rotlimit_evaluate(), and blender::animrig::visualkey_get_values().
| void mat4_to_quat | ( | float | q[4], |
| const float | mat[4][4] ) |
Definition at line 413 of file math_rotation_c.cc.
References copy_m3_m4(), mat3_normalized_to_quat_with_checks(), and normalize_m3().
Referenced by bc_decompose(), bc_rotate_from_reference_quat(), BKE_driver_target_matrix_to_rot_channels(), BKE_mball_transform(), blender::ed::transform::constraintRotLim(), dvar_eval_rotDiff(), execute_posetree(), mat4_to_axis_angle(), mat4_to_dquat(), Matrix_to_quaternion(), psys_get_birth_coords(), BCQuat::rotate_to(), blender::animrig::visualkey_get_values(), wm_xr_navigation_fly_modal(), and wm_xr_navigation_grab_apply().
| void mul_qt_fl | ( | float | q[4], |
| float | f ) |
Simple multiply.
Definition at line 141 of file math_rotation_c.cc.
Referenced by dquat_to_mat4(), invert_qt(), normalize_dq(), normalize_qt(), blender::ed::object::object_clear_rot(), pchan_clear_rot(), blender::ed::transform::protectedQuaternionBits(), quat_mul_float(), Quaternion_angle_set(), Quaternion_axis_vector_set(), Quaternion_imul(), Quaternion_make_compatible(), Quaternion_negate(), Quaternion_rotate(), rotation_between_quats_to_quat(), and test_quat_to_mat_to_quat().
| void mul_qt_qtqt | ( | float | q[4], |
| const float | a[4], | ||
| const float | b[4] ) |
Definition at line 60 of file math_rotation_c.cc.
References b.
Referenced by add_eul_euleul(), axis_set_view(), basic_rotate(), bc_rotate_from_reference_quat(), bevel_list_apply_tilt(), bevel_list_smooth(), BKE_mball_transform(), BKE_object_mat3_to_rot(), bm_edgering_pair_interpolate(), cache_key_incremental_rotation(), calc_curve_deform(), dvar_eval_rotDiff(), ED_view3d_cursor3d_position_rotation(), blender::ed::transform::ElementRotation_ex(), flyApply(), interpolate_pathcache(), make_bevel_list_3D_minimum_twist(), make_bevel_list_segment_3D(), mat3_to_quat_legacy(), minimum_twist_between_two_points(), modify_mesh(), nla_combine_quaternion(), nla_combine_quaternion_get_inverted_lower_values(), nla_combine_quaternion_get_inverted_strip_values(), psys_get_birth_coords(), psys_path_iter_get(), psys_thread_create_path(), quat_apply_track(), quat_split_swing_and_twist(), quat_to_compatible_quat(), Quaternion_cross(), Quaternion_imatmul(), Quaternion_matmul(), BCQuat::rotate_to(), rotation_between_quats_to_quat(), blender::ed::object::rotation_from_quat(), sub_eul_euleul(), sub_qt_qtqt(), tri_to_quat_ex(), vec_to_quat(), view3d_orbit_apply_dyn_ofs(), view_axis_exec(), view_roll_angle(), vieworbit_exec(), viewrotate_apply(), viewrotate_apply_snap(), walkApply(), wm_xr_basenav_rotation_calc(), and wm_xr_session_base_pose_calc().
| void mul_qt_v3 | ( | const float | q[4], |
| float | r[3] ) |
in fact not, but you may want to use a unit quaternion read on...
Shortcut for 'q v q*' when v is actually a quaternion. This removes the need for converting a vector to a quaternion, calculating q's conjugate and converting back to a vector. It also happens to be faster (17+,24* vs * 24+,32*). If q is not a unit quaternion, then v will be both rotated by the same amount as if q was a unit quaternion, and scaled by the square of the length of q.
For people used to python mathutils, its like: def mul_qt_v3(q, v): (q * Quaternion((0.0, v[0], v[1], v[2])) * q.conjugated())[1:]
Definition at line 73 of file math_rotation_c.cc.
Referenced by blender::ed::transform::axis_angle_to_gimbal_axis(), bevel_list_smooth(), bm_edgering_pair_interpolate(), boid_body(), calc_curve_deform(), blender::draw::curve_create_edit_curves_nor(), do_guides(), do_kink(), do_physical_effector(), draw_view_axis(), ED_view3d_cursor3d_position_rotation(), ED_view3d_distance_set(), ED_view3d_distance_set_from_location(), explodeMesh(), get_effector_data(), gizmo_ruler_draw(), knifetool_draw_angle(), make_bevel_list_3D_minimum_twist(), mball_select_similar_type(), mball_select_similar_type_get(), modify_mesh(), offset_child(), psys_get_birth_coords(), psys_get_dupli_path_transform(), psys_thread_create_path(), Quaternion_matmul(), blender::ed::transform::recalcData_edit_armature(), rotateBevelPiece(), rule_average_speed(), view3d_boxview_sync_axis(), view3d_orbit_apply_dyn_ofs(), view3d_orbit_apply_dyn_ofs_ortho_correction(), viewrotate_apply_snap(), wm_xr_navigation_reset_exec(), and wm_xr_raycast_update().
| void mul_v3m3_dq | ( | float | r[3], |
| float | R[3][3], | ||
| DualQuat * | dq ) |
Definition at line 2168 of file math_rotation_c.cc.
References copy_m3_m3(), copy_m3_m4(), dot_qtqt(), M, mul_m3_fl(), mul_m3_m3m3(), mul_m3_v3(), mul_m4_v3(), DualQuat::quat, R, DualQuat::scale, DualQuat::scale_weight, DualQuat::trans, w(), x, y, and z().
Referenced by armature_vert_task_with_dvert(), and blender::math::tests::TEST().
| void normalize_dq | ( | DualQuat * | dq, |
| float | totweight ) |
Definition at line 2143 of file math_rotation_c.cc.
References mul_m4_fl(), mul_qt_fl(), DualQuat::quat, DualQuat::scale, DualQuat::scale_weight, and DualQuat::trans.
Referenced by armature_vert_task_with_dvert(), and armdef_evaluate().
| float normalize_qt | ( | float | q[4] | ) |
Definition at line 468 of file math_rotation_c.cc.
References dot_qtqt(), len, mul_qt_fl(), and sqrtf.
Referenced by animsys_quaternion_evaluate_fcurves(), basic_rotate(), bevel_list_apply_tilt(), bevel_list_smooth(), BKE_rotMode_change_values(), bm_edgering_pair_interpolate(), calc_curve_deform(), joint_callback(), make_bevel_list_segment_3D(), mat3_normalized_to_quat_fast(), normalize_qt_qt(), ob_parcurve(), pose_bone_do_paste(), pose_slide_apply_quat(), psys_get_birth_coords(), Quaternion_normalize(), blender::ed::sculpt_paint::transform_matrices_init(), view_roll_angle(), vieworbit_exec(), viewrotate_apply(), viewrotate_apply_snap(), and wm_xr_navigation_grab_apply().
| float normalize_qt_qt | ( | float | r[4], |
| const float | q[4] ) |
Definition at line 483 of file math_rotation_c.cc.
References copy_qt_qt(), and normalize_qt().
Referenced by angle_qt(), angle_qtqt(), angle_signed_qt(), axis_set_view(), BKE_object_mat3_to_rot(), BKE_object_rot_to_mat3(), BKE_pchan_rot_to_mat3(), blender::ed::transform::constraintob_from_transdata(), make_duplis_particle_system(), mathutils_any_to_rotmat(), nla_combine_quaternion(), nla_combine_quaternion_get_inverted_lower_values(), nla_combine_quaternion_get_inverted_strip_values(), pchan_clear_rot(), pose_slide_apply_quat(), blender::ed::transform::protectedQuaternionBits(), quat_to_compatible_quat(), quat_to_expmap(), Quaternion_angle_get(), Quaternion_angle_set(), Quaternion_axis_vector_get(), Quaternion_axis_vector_set(), Quaternion_make_compatible(), Quaternion_rotate(), Quaternion_to_axis_angle(), Quaternion_to_euler(), test_quat_to_mat_to_quat(), blender::ed::transform::transform_data_ext_rotate(), and View3DCursor::matrix< blender::float3x3 >().
| void pow_qt_fl_normalized | ( | float | q[4], |
| float | fac ) |
Raise a unit quaternion to the specified power.
Definition at line 161 of file math_rotation_c.cc.
References angle(), BLI_ASSERT_UNIT_QUAT, cosf, normalize_v3_length(), safe_acosf(), and sinf.
Referenced by nla_combine_quaternion(), nla_combine_quaternion_get_inverted_lower_values(), and nla_combine_quaternion_get_inverted_strip_values().
| void print_qt | ( | const char * | str, |
| const float | q[4] ) |
Definition at line 1044 of file math_rotation_c.cc.
| void quat_apply_track | ( | float | quat[4], |
| short | axis, | ||
| short | upflag ) |
Axis matches eTrackToAxis_Modes.
Definition at line 2226 of file math_rotation_c.cc.
References BLI_assert, M_SQRT1_2, and mul_qt_qtqt().
Referenced by calc_curve_deform(), followpath_get_tarmat(), ob_parcurve(), and blender::math::tests::TEST().
| void quat_normalized_to_expmap | ( | float | expmap[3], |
| const float | q[4] ) |
Definition at line 1305 of file math_rotation_c.cc.
References angle(), BLI_ASSERT_UNIT_QUAT, mul_v3_fl(), and quat_to_axis_angle().
Referenced by quat_to_expmap().
| float quat_split_swing_and_twist | ( | const float | q_in[4], |
| int | axis, | ||
| float | r_swing[4], | ||
| float | r_twist[4] ) |
Decompose a quaternion into a swing rotation (quaternion with the selected axis component locked at zero), followed by a twist rotation around the axis.
| q | input quaternion. |
| axis | twist axis in [0,1,2] |
| r_swing | if not NULL, receives the swing quaternion. |
| r_twist | if not NULL, receives the twist quaternion. |
Definition at line 565 of file math_rotation_c.cc.
References atan2f, BLI_assert, BLI_ASSERT_UNIT_EPSILON, copy_v4_v4(), cosf, fabsf, mul_qt_qtqt(), negate_v4_v4(), sinf, and zero_v3().
Referenced by BKE_driver_target_matrix_to_rot_channels(), mat3_vec_to_roll(), Quaternion_to_swing_twist(), and TEST().
| void quat_to_axis_angle | ( | float | axis[3], |
| float * | angle, | ||
| const float | q[4] ) |
Quaternions to Axis Angle.
Definition at line 1073 of file math_rotation_c.cc.
References acosf, angle(), dot_qtqt(), fabsf, is_zero_v3(), QUAT_EPSILON, and sinf.
Referenced by BKE_object_mat3_to_rot(), BKE_rotMode_change_values(), blender::ed::transform::ElementRotation_ex(), eulO_to_axis_angle(), flip_qt_qt(), mat3_normalized_to_axis_angle(), mat3_to_axis_angle(), mat4_normalized_to_axis_angle(), mat4_to_axis_angle(), pose_bone_do_paste(), quat_normalized_to_expmap(), Quaternion_angle_set(), Quaternion_axis_vector_get(), Quaternion_axis_vector_set(), and Quaternion_to_axis_angle().
| void quat_to_compatible_eul | ( | float | eul[3], |
| const float | oldrot[3], | ||
| const float | quat[4] ) |
Definition at line 1585 of file math_rotation_c.cc.
References mat3_normalized_to_compatible_eul(), and quat_to_mat3().
Referenced by Quaternion_to_euler(), and BCMatrix::set_transform().
| void quat_to_compatible_eulO | ( | float | eul[3], |
| const float | oldrot[3], | ||
| short | order, | ||
| const float | quat[4] ) |
Definition at line 1871 of file math_rotation_c.cc.
References mat3_normalized_to_compatible_eulO(), and quat_to_mat3().
Referenced by BKE_object_mat3_to_rot(), and Quaternion_to_euler().
| void quat_to_compatible_quat | ( | float | q[4], |
| const float | a[4], | ||
| const float | old[4] ) |
Apply the rotation of a to q keeping the values compatible with old. Avoid axis flipping for animated f-curves for eg.
Definition at line 172 of file math_rotation_c.cc.
References BLI_ASSERT_UNIT_QUAT, copy_qt_qt(), eps, len_squared_v4v4(), mul_qt_qtqt(), negate_v4_v4(), normalize_qt_qt(), and rotation_between_quats_to_quat().
Referenced by pose_slide_apply_quat(), and Quaternion_make_compatible().
| void quat_to_eul | ( | float | eul[3], |
| const float | quat[4] ) |
Definition at line 1458 of file math_rotation_c.cc.
References mat3_normalized_to_eul(), and quat_to_mat3().
Referenced by blender::ed::object::object_clear_rot(), pchan_clear_rot(), pose_bone_do_paste(), blender::ed::transform::protectedQuaternionBits(), Quaternion_to_euler(), blender::ed::object::rotation_from_quat(), BCMatrix::set_transform(), blender::io::usd::USDTransformWriter::set_xform_ops(), wm_xr_basenav_rotation_calc(), and wm_xr_session_base_pose_calc().
| void quat_to_eulO | ( | float | e[3], |
| short | order, | ||
| const float | q[4] ) |
Convert quaternion to Euler angles (in radians).
Definition at line 1676 of file math_rotation_c.cc.
References e, mat3_normalized_to_eulO(), and quat_to_mat3().
Referenced by add_eul_euleul(), axis_angle_to_eulO(), BKE_object_mat3_to_rot(), BKE_rotMode_change_values(), mapping_node_order_flip(), pose_bone_do_paste(), Quaternion_to_euler(), and sub_eul_euleul().
| void quat_to_expmap | ( | float | expmap[3], |
| const float | q[4] ) |
Definition at line 1317 of file math_rotation_c.cc.
References normalize_qt_qt(), and quat_normalized_to_expmap().
Referenced by Quaternion_to_exponential_map().
| void quat_to_mat3 | ( | float | m[3][3], |
| const float | q[4] ) |
Definition at line 226 of file math_rotation_c.cc.
References dot_qtqt(), fabsf, QUAT_EPSILON, and quat_to_mat3_no_error().
Referenced by BKE_crazyspace_build_sculpt(), BKE_curve_deform_co(), BKE_object_rot_to_mat3(), BKE_pchan_rot_to_mat3(), blend_m3_m3m3(), blender::ed::transform::createTransMBallVerts(), ED_view3d_cursor3d_update(), blender::ed::transform::ElementRotation_ex(), execute_posetree(), blender::ed::transform::getTransformOrientation_ex(), interp_m3_m3m3(), joint_callback(), loc_quat_size_to_mat4(), mathutils_any_to_rotmat(), ob_parvert3(), quat_to_compatible_eul(), quat_to_compatible_eulO(), quat_to_eul(), quat_to_eulO(), Quaternion_rotate(), Quaternion_to_matrix(), TEST(), test_quat_to_mat_to_quat(), blender::ed::transform::transform_convert_mesh_crazyspace_transdata_set(), blender::ed::transform::transform_data_ext_rotate(), tri_to_quat_ex(), vec_to_quat(), View3DCursor::matrix< blender::float3x3 >(), viewrotate_apply(), wm_xr_fly_compute_move(), wm_xr_grab_compute_bimanual(), wm_xr_navigation_reset_exec(), and wm_xr_navigation_teleport().
| void quat_to_mat4 | ( | float | m[4][4], |
| const float | q[4] ) |
Definition at line 240 of file math_rotation_c.cc.
References dot_qtqt(), fabs(), M_SQRT2, and QUAT_EPSILON.
Referenced by bc_rotate_from_reference_quat(), C_Matrix_LocRotScale(), blender::ed::transform::constraintob_from_transdata(), TransformReader::dae_rotate_to_mat4(), blender::ed::sculpt_paint::pose::do_pose_brush(), dquat_to_mat4(), blender::ed::sculpt_paint::dyntopo::dyntopo_detail_size_edit_invoke(), ED_view3d_to_m4(), followpath_get_tarmat(), init_meta(), make_duplis_particle_system(), mat4_to_dquat(), ob_parcurve(), psys_get_dupli_path_transform(), BCQuat::rotate_to(), blender::ed::sculpt_paint::cloth::simulation_limits_draw(), blender::ed::sculpt_paint::transform_matrices_init(), view3d_viewmatrix_set(), wm_xr_grab_compute(), wm_xr_grab_update(), wm_xr_navigation_grab_bimanual_state_update(), wm_xr_pose_scale_to_imat(), wm_xr_pose_to_imat(), and wm_xr_pose_to_mat().
| void rotate_eul | ( | float | beul[3], |
| char | axis, | ||
| float | angle ) |
Definition at line 1489 of file math_rotation_c.cc.
References angle(), BLI_assert, eul_to_mat3(), mat3_to_eul(), and mul_m3_m3m3().
| void rotate_eulO | ( | float | beul[3], |
| short | order, | ||
| char | axis, | ||
| float | angle ) |
Definition at line 1885 of file math_rotation_c.cc.
References angle(), BLI_assert, eulO_to_mat3(), mat3_to_eulO(), mul_m3_m3m3(), and zero_v3().
Referenced by Euler_rotate_axis(), and rotlike_evaluate().
| void rotation_between_quats_to_quat | ( | float | q[4], |
| const float | q1[4], | ||
| const float | q2[4] ) |
Definition at line 554 of file math_rotation_c.cc.
References conjugate_qt_qt(), dot_qtqt(), mul_qt_fl(), and mul_qt_qtqt().
Referenced by angle_normalized_qtqt(), quat_to_compatible_quat(), Quaternion_rotation_difference(), and blender::ed::sculpt_paint::pose::solve_roll_chain().
| void rotation_between_vecs_to_mat3 | ( | float | m[3][3], |
| const float | v1[3], | ||
| const float | v2[3] ) |
Calculate a rotation matrix from 2 normalized vectors.
Definition at line 489 of file math_rotation_c.cc.
References axis_angle_normalized_to_mat3_ex(), BLI_ASSERT_UNIT_M3, BLI_ASSERT_UNIT_V3, cross_v3_v3v3(), dot_v3v3(), normalize_v3(), ortho_v3_v3(), unit_m3(), and v2.
Referenced by blender::ed::transform::applyFaceProject(), blender::geometry::calc_position_with_interpolation(), cloth_parallel_transport_hair_frame(), ED_view3d_win_to_3d_on_plane_with_fallback(), blender::ed::sculpt_paint::SlideOperationExecutor::get_slide_transform(), gizmo_mesh_spin_redo_update_orient_axis(), blender::ed::object::object_orient_to_location(), blender::ed::transform::transdata_elem_translate(), and wm_gizmo_set_matrix_rotation_from_z_axis__internal().
| void rotation_between_vecs_to_quat | ( | float | q[4], |
| const float | v1[3], | ||
| const float | v2[3] ) |
Definition at line 526 of file math_rotation_c.cc.
References angle(), angle_normalized_v3v3(), axis_angle_normalized_to_quat(), axis_angle_to_quat(), cross_v3_v3v3(), dot_v3v3(), M_PI, normalize_v3(), ortho_v3_v3(), unit_qt(), and v2.
Referenced by calc_curve_deform(), blender::ed::sculpt_paint::dyntopo::dyntopo_detail_size_edit_invoke(), ED_view3d_cursor3d_position_rotation(), blender::ed::view3d::geometry_nodes_gizmos::matrix_from_position_and_up_direction(), modify_mesh(), blender::ed::transform::recalcData_edit_armature(), blender::ed::sculpt_paint::cloth::simulation_limits_draw(), blender::ed::sculpt_paint::pose::solve_ik_chain(), Vector_rotation_difference(), and viewrotate_apply_snap().
| void sin_cos_from_fraction | ( | int | numerator, |
| int | denominator, | ||
| float * | r_sin, | ||
| float * | r_cos ) |
Utility that performs sinf & cosf intended for plotting a 2D circle, where the values of the coordinates with are exactly symmetrical although this favors even numbers as odd numbers can only be symmetrical on a single axis.
Besides adjustments to precision, this function is the equivalent of:
| numerator | An integer factor in [0..denominator] (inclusive). |
| denominator | The fraction denominator (typically the number of segments of the circle). |
| r_sin | The resulting sine. |
| r_cos | The resulting cosine. |
Definition at line 985 of file math_rotation_c.cc.
References angle(), BLI_assert, BLI_assert_unreachable, cosf, ELEM, M_PI, sinf, and SWAP.
Referenced by bmo_create_circle_exec(), bmo_create_cone_exec(), bmo_create_uvsphere_exec(), TEST(), TEST(), test_sin_cos_from_fraction_accuracy(), and test_sin_cos_from_fraction_symmetry().
| void sub_eul_euleul | ( | float | r_eul[3], |
| float | a[3], | ||
| float | b[3], | ||
| short | order ) |
Definition at line 1945 of file math_rotation_c.cc.
References b, eulO_to_quat(), invert_qt_normalized(), mul_qt_qtqt(), and quat_to_eulO().
Referenced by blender::ed::transform::ElementRotation_ex().
| void sub_qt_qtqt | ( | float | q[4], |
| const float | a[4], | ||
| const float | b[4] ) |
Definition at line 149 of file math_rotation_c.cc.
References b, and mul_qt_qtqt().
Referenced by explodeMesh(), set_crazy_vertex_quat(), and blender::ed::sculpt_paint::transform_matrices_init().
| float tri_to_quat | ( | float | q[4], |
| const float | a[3], | ||
| const float | b[3], | ||
| const float | c[3] ) |
Definition at line 976 of file math_rotation_c.cc.
References b, len, normal_tri_v3(), and tri_to_quat_ex().
Referenced by make_bevel_list_3D_tangent(), and ob_parvert3().
| void tri_to_quat_ex | ( | float | quat[4], |
| const float | v1[3], | ||
| const float | v2[3], | ||
| const float | v3[3], | ||
| const float | no_orig[3] ) |
Same as tri_to_quat() but takes pre-computed normal from the triangle used for ngons when we know their normal.
Definition at line 924 of file math_rotation_c.cc.
References angle(), atan2f, copy_v3_v3(), cosf, invert_m3_m3(), mul_m3_v3(), mul_qt_qtqt(), normal_tri_v3(), normalize_v3(), quat_to_mat3(), safe_acosf(), sinf, sub_v3_v3v3(), and v2.
Referenced by get_dupliface_transform_from_coords(), tan_calc_quat_v3(), and tri_to_quat().
| void unit_axis_angle | ( | float | axis[3], |
| float * | angle ) |
Definition at line 33 of file math_rotation_c.cc.
References angle().
Referenced by blender::ed::object::apply_objects_internal(), applyarmature_transfer_properties(), BKE_pose_channel_ensure(), BKE_pose_rest(), blo_do_versions_250(), blender::ed::object::object_clear_rot(), and pchan_clear_rot().
| void unit_qt | ( | float | q[4] | ) |
Definition at line 41 of file math_rotation_c.cc.
Referenced by blender::ed::object::apply_objects_internal(), applyarmature_transfer_properties(), axis_angle_to_quat(), basic_rotate(), BCQuat::BCQuat(), BKE_curve_bevelList_make(), BKE_mball_element_add(), BKE_pose_channel_ensure(), BKE_pose_rest(), blo_do_versions_250(), cache_key_incremental_rotation(), expmap_to_quat(), get_duplivert_transform(), modify_mesh(), nlaevalchan_get_default_values(), blender::ed::object::object_clear_rot(), offset_child(), particles_fluid_step(), pchan_clear_rot(), psys_get_birth_coords(), psys_path_iter_get(), psys_thread_create_path(), ptcache_particle_interpolate(), ptcache_particle_read(), Quaternion_CreatePyObject(), Quaternion_identity(), Quaternion_new(), rotation_between_vecs_to_quat(), blender::ed::sculpt_paint::pose::solve_translate_chain(), tan_calc_quat_v3(), vec_to_quat(), view_axis_exec(), wm_xr_navigation_reset_exec(), WM_xr_session_state_controller_aim_rotation_get(), WM_xr_session_state_controller_grip_rotation_get(), WM_xr_session_state_nav_rotation_get(), WM_xr_session_state_navigation_reset(), and WM_xr_session_state_viewer_pose_rotation_get().
| void vec_apply_track | ( | float | vec[3], |
| short | axis ) |
Definition at line 2264 of file math_rotation_c.cc.
References BLI_assert, and copy_v3_v3().
Referenced by calc_curve_deform().
| void vec_to_quat | ( | float | q[4], |
| const float | vec[3], | ||
| short | axis, | ||
| short | upflag ) |
Definition at line 712 of file math_rotation_c.cc.
References angle(), atan2f, axis_angle_normalized_to_quat(), BLI_assert, copy_v3_v3(), cosf, eps, fabsf, len, len_v3(), mul_qt_qtqt(), negate_v3_v3(), nor, normalize_v3(), quat_to_mat3(), safe_acosf(), sinf, unit_qt(), and UNLIKELY.
Referenced by BKE_ptcache_make_particle_key(), bm_edgering_pair_interpolate(), get_duplivert_transform(), make_bevel_list_2D(), make_bevel_list_3D_minimum_twist(), make_bevel_list_3D_zup(), make_bevel_list_segment_3D(), make_duplis_particle_system(), blender::nodes::node_geo_distribute_points_on_faces_cc::normal_to_rotation(), psys_get_birth_coords(), Vector_to_track_quat(), and viewrotate_apply_snap().