[Bf-blender-cvs] [9de8c2fa186] master: BLI: Add accessors for translation, rotation, and scale of float4x4
Hans Goudey
noreply at git.blender.org
Fri Mar 19 20:29:06 CET 2021
Commit: 9de8c2fa186fe52a9cad9fe32fd9c860f72b3eed
Author: Hans Goudey
Date: Fri Mar 19 15:28:58 2021 -0400
Branches: master
https://developer.blender.org/rB9de8c2fa186fe52a9cad9fe32fd9c860f72b3eed
BLI: Add accessors for translation, rotation, and scale of float4x4
===================================================================
M source/blender/blenlib/BLI_float4x4.hh
===================================================================
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;
More information about the Bf-blender-cvs
mailing list