diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-01-27 16:37:24 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-01-27 16:37:24 +0300 |
commit | 6016dbb1a75566e1fb3ca257a1f13b9bba4467fd (patch) | |
tree | 30ca1741378f36e7c6af17beb1b12c46fb487d05 /source/blender/blenlib/BLI_math_matrix.h | |
parent | c453aaa0b2408b50af7d47722114f1903f27a6fc (diff) | |
parent | 0379ddac7d68114798c8963821fd821c1b3d7d28 (diff) |
Merge branch 'master' into temp-gpu-image-engine
# Conflicts:
# source/blender/blenkernel/CMakeLists.txt
# source/blender/draw/CMakeLists.txt
Diffstat (limited to 'source/blender/blenlib/BLI_math_matrix.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_matrix.h | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index cdbc0cb0283..03b6ff25a4f 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -56,16 +56,18 @@ void copy_m4_m2(float m1[4][4], const float m2[2][2]); void copy_m4_m4_db(double m1[4][4], const double m2[4][4]); /* double->float */ + void copy_m3_m3d(float m1[3][3], const double m2[3][3]); /* float->double */ + void copy_m3d_m3(double m1[3][3], const float m2[3][3]); void copy_m4d_m4(double m1[4][4], const float m2[4][4]); void swap_m3m3(float m1[3][3], float m2[3][3]); void swap_m4m4(float m1[4][4], float m2[4][4]); -/* Build index shuffle matrix */ +/** Build index shuffle matrix. */ void shuffle_m4(float R[4][4], const int index[4]); /** \} */ @@ -77,8 +79,8 @@ void shuffle_m4(float R[4][4], const int index[4]); void add_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]); void add_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]); -void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], const float f); -void madd_m4_m4m4fl(float R[4][4], const float A[4][4], const float B[4][4], const float f); +void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], float f); +void madd_m4_m4m4fl(float R[4][4], const float A[4][4], const float B[4][4], float f); void sub_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]); void sub_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]); @@ -112,7 +114,8 @@ void mul_m4db_m4db_m4fl_uniq(double R[4][4], const double A[4][4], const float B void mul_m4_m4_pre(float R[4][4], const float A[4][4]); void mul_m4_m4_post(float R[4][4], const float B[4][4]); -/* mul_m3_series */ +/* Implement #mul_m3_series macro. */ + void _va_mul_m3_series_3(float R[3][3], const float M1[3][3], const float M2[3][3]) ATTR_NONNULL(); void _va_mul_m3_series_4(float R[3][3], const float M1[3][3], @@ -153,7 +156,9 @@ void _va_mul_m3_series_9(float R[3][3], const float M6[3][3], const float M7[3][3], const float M8[3][3]) ATTR_NONNULL(); -/* mul_m4_series */ + +/* Implement #mul_m4_series macro. */ + void _va_mul_m4_series_3(float R[4][4], const float M1[4][4], const float M2[4][4]) ATTR_NONNULL(); void _va_mul_m4_series_4(float R[4][4], const float M1[4][4], @@ -247,8 +252,8 @@ void negate_m3(float R[3][3]); void negate_mat3_m4(float R[4][4]); void negate_m4(float R[4][4]); -bool invert_m3_ex(float m[3][3], const float epsilon); -bool invert_m3_m3_ex(float m1[3][3], const float m2[3][3], const float epsilon); +bool invert_m3_ex(float m[3][3], float epsilon); +bool invert_m3_m3_ex(float m1[3][3], const float m2[3][3], float epsilon); bool invert_m3(float R[3][3]); bool invert_m3_m3(float R[3][3], const float A[3][3]); @@ -266,11 +271,13 @@ bool invert_m4_m4(float R[4][4], const float A[4][4]); */ bool invert_m4_m4_fallback(float R[4][4], const float A[4][4]); -/* double arithmetic (mixed float/double) */ +/* Double arithmetic (mixed float/double). */ + void mul_m4_v4d(const float M[4][4], double r[4]); void mul_v4d_m4v4d(double r[4], const float M[4][4], const double v[4]); -/* double matrix functions (no mixing types) */ +/* Double matrix functions (no mixing types). */ + void mul_v3_m3v3_db(double r[3], const double M[3][3], const double a[3]); void mul_m3_v3_db(const double M[3][3], double r[3]); @@ -282,7 +289,9 @@ void mul_m3_v3_db(const double M[3][3], double r[3]); void transpose_m3(float R[3][3]); void transpose_m3_m3(float R[3][3], const float M[3][3]); -/* seems obscure but in-fact a common operation */ +/** + * \note Seems obscure but in-fact a common operation. + */ void transpose_m3_m4(float R[3][3], const float M[4][4]); void transpose_m4(float R[4][4]); void transpose_m4_m4(float R[4][4], const float M[4][4]); @@ -334,8 +343,8 @@ void orthogonalize_m3_stable(float R[3][3], int axis, bool normalize); */ void orthogonalize_m4_stable(float R[4][4], int axis, bool normalize); -bool orthogonalize_m3_zero_axes(float R[3][3], const float unit_length); -bool orthogonalize_m4_zero_axes(float R[4][4], const float unit_length); +bool orthogonalize_m3_zero_axes(float R[3][3], float unit_length); +bool orthogonalize_m4_zero_axes(float R[4][4], float unit_length); bool is_orthogonal_m3(const float mat[3][3]); bool is_orthogonal_m4(const float mat[4][4]); @@ -435,7 +444,7 @@ void translate_m4(float mat[4][4], float tx, float ty, float tz); * #axis_angle_to_mat4_single, #axis_angle_to_mat3_single, #angle_to_mat2 * (axis & angle args are compatible). */ -void rotate_m4(float mat[4][4], const char axis, const float angle); +void rotate_m4(float mat[4][4], char axis, float angle); /** Scale a matrix in-place. */ void rescale_m4(float mat[4][4], const float scale[3]); /** @@ -479,7 +488,7 @@ void loc_eul_size_to_mat4(float R[4][4], * Matrices are made in the order: `scale * rot * loc` */ void loc_eulO_size_to_mat4( - float R[4][4], const float loc[3], const float eul[3], const float size[3], const short order); + float R[4][4], const float loc[3], const float eul[3], const float size[3], short order); /** * Make a 4x4 matrix out of 3 transform components. * Matrices are made in the order: `scale * rot * loc` @@ -488,20 +497,11 @@ void loc_quat_size_to_mat4(float R[4][4], const float loc[3], const float quat[4], const float size[3]); -void loc_axisangle_size_to_mat4(float R[4][4], - const float loc[3], - const float axis[3], - const float angle, - const float size[3]); - -void blend_m3_m3m3(float out[3][3], - const float dst[3][3], - const float src[3][3], - const float srcweight); -void blend_m4_m4m4(float out[4][4], - const float dst[4][4], - const float src[4][4], - const float srcweight); +void loc_axisangle_size_to_mat4( + float R[4][4], const float loc[3], const float axis[3], float angle, const float size[3]); + +void blend_m3_m3m3(float out[3][3], const float dst[3][3], const float src[3][3], float srcweight); +void blend_m4_m4m4(float out[4][4], const float dst[4][4], const float src[4][4], float srcweight); /** * A polar-decomposition-based interpolation between matrix A and matrix B. @@ -519,7 +519,7 @@ void blend_m4_m4m4(float out[4][4], * \param B: Input matrix which is totally effective with `t = 1.0`. * \param t: Interpolation factor. */ -void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], const float t); +void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], float t); /** * Complete transform matrix interpolation, * based on polar-decomposition-based interpolation from #interp_m3_m3m3. @@ -529,7 +529,7 @@ void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], con * \param B: Input matrix which is totally effective with `t = 1.0`. * \param t: Interpolation factor. */ -void interp_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4], const float t); +void interp_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4], float t); bool is_negative_m3(const float mat[3][3]); bool is_negative_m4(const float mat[4][4]); |