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-15 05:36:35 +0300
committerHans Goudey <h.goudey@me.com>2021-03-15 05:36:35 +0300
commitc23da7a5c9079702a33ea2309d9ee1d714481237 (patch)
tree020fac68601855329424d947c78376a409bd3fc3 /source/blender/blenlib/BLI_float2.hh
parent070010e203f6cf9ac8fe30c8b60a5394df98e730 (diff)
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
Diffstat (limited to 'source/blender/blenlib/BLI_float2.hh')
-rw-r--r--source/blender/blenlib/BLI_float2.hh5
1 files changed, 5 insertions, 0 deletions
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;