Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-03-19 22:28:58 +0300
committerHans Goudey <h.goudey@me.com>2021-03-19 22:28:58 +0300
commit9de8c2fa186fe52a9cad9fe32fd9c860f72b3eed (patch)
treee8e35103d7e171909f177fbead13368659528f54 /source/blender/blenlib/BLI_float4x4.hh
parentdd7feb09c9ba5dc0daac419297b89439dbfdfd80 (diff)
BLI: Add accessors for translation, rotation, and scale of float4x4
Diffstat (limited to 'source/blender/blenlib/BLI_float4x4.hh')
-rw-r--r--source/blender/blenlib/BLI_float4x4.hh20
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;