diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-11-14 08:10:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-14 08:10:48 +0300 |
commit | 40ad1cf0b1203848508cf6389e4337eb5071edf6 (patch) | |
tree | bd46e49b9e8f9b25b414828cd1de540ddea177e7 /source/blender/blenlib/intern/math_matrix.c | |
parent | 212a8d9e5ae78a30ed4c35161d91eeca35eaa41f (diff) |
BLI: sync changes from 2.8
Diffstat (limited to 'source/blender/blenlib/intern/math_matrix.c')
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index d1a219c196a..311d963f64d 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -1523,6 +1523,15 @@ float mat4_to_scale(float mat[4][4]) return len_v3(unit_vec); } +/** Return 2D scale (in XY plane) of given mat4. */ +float mat4_to_xy_scale(float M[4][4]) +{ + /* unit length vector in xy plane */ + float unit_vec[3] = {(float)M_SQRT1_2, (float)M_SQRT1_2, 0.0f}; + mul_mat3_m4_v3(M, unit_vec); + return len_v3(unit_vec); +} + void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3]) { /* keep rot as a 3x3 matrix, the caller can convert into a quat or euler */ @@ -1625,6 +1634,7 @@ void translate_m4(float mat[4][4], float Tx, float Ty, float Tz) mat[3][2] += (Tx * mat[0][2] + Ty * mat[1][2] + Tz * mat[2][2]); } +/* TODO: enum for axis? */ /** * Rotate a matrix in-place. * |