Commit: c23da7a5c9079702a33ea2309d9ee1d714481237
Author: Hans Goudey
Date:   Sun Mar 14 22:36:35 2021 -0400
Branches: master
https://developer.blender.org/rBc23da7a5c9079702a33ea2309d9ee1d714481237

BLI: Add "is_zero" method to float2 and float3 types

This is not necessary, but a nice convenience to avoid using `is_zero_v3`.

Differential Revision: https://developer.blender.org/D10713

===================================================================

M       source/blender/blenlib/BLI_float2.hh
M       source/blender/blenlib/BLI_float3.hh

===================================================================

diff --git a/source/blender/blenlib/BLI_float2.hh 
b/source/blender/blenlib/BLI_float2.hh
index 84dd0e358a2..cf6e00ba938 100644
--- a/source/blender/blenlib/BLI_float2.hh
+++ b/source/blender/blenlib/BLI_float2.hh
@@ -65,6 +65,11 @@ struct float2 {
     return len_squared_v2(*this);
   }
 
+  bool is_zero() const
+  {
+    return this->x == 0.0f && this->y == 0.0f;
+  }
+
   float2 &operator+=(const float2 &other)
   {
     x += other.x;
diff --git a/source/blender/blenlib/BLI_float3.hh 
b/source/blender/blenlib/BLI_float3.hh
index 9a8870963bf..7e49cc89b52 100644
--- a/source/blender/blenlib/BLI_float3.hh
+++ b/source/blender/blenlib/BLI_float3.hh
@@ -174,6 +174,11 @@ struct float3 {
     return len_squared_v3(*this);
   }
 
+  bool is_zero() const
+  {
+    return this->x == 0.0f && this->y == 0.0f && this->z == 0.0f;
+  }
+
   void reflect(const float3 &normal)
   {
     *this = this->reflected(normal);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to