diff options
author | Hans Goudey <h.goudey@me.com> | 2021-03-19 22:28:58 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-03-19 22:28:58 +0300 |
commit | 9de8c2fa186fe52a9cad9fe32fd9c860f72b3eed (patch) | |
tree | e8e35103d7e171909f177fbead13368659528f54 | |
parent | dd7feb09c9ba5dc0daac419297b89439dbfdfd80 (diff) |
BLI: Add accessors for translation, rotation, and scale of float4x4
-rw-r--r-- | source/blender/blenlib/BLI_float4x4.hh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float4x4.hh b/source/blender/blenlib/BLI_float4x4.hh index b44c07a38e4..a3eec075027 100644 --- a/source/blender/blenlib/BLI_float4x4.hh +++ b/source/blender/blenlib/BLI_float4x4.hh @@ -89,6 +89,26 @@ struct float4x4 { return m * float3(v); } + float3 translation() const + { + return float3(values[3]); + } + + /* Assumes XYZ rotation order. */ + float3 to_euler() const + { + float3 euler; + mat4_to_eul(euler, values); + return euler; + } + + float3 scale() const + { + float3 scale; + mat4_to_size(scale, values); + return scale; + } + float4x4 inverted() const { float4x4 result; |