[Bf-blender-cvs] [3623db7784b] master: BLI: add more operator overloads for float2
Jacques Lucke
noreply at git.blender.org
Thu Jul 9 19:04:58 CEST 2020
Commit: 3623db7784b377cfe9c0428f7a9dd4c06415241a
Author: Jacques Lucke
Date: Thu Jul 9 19:03:50 2020 +0200
Branches: master
https://developer.blender.org/rB3623db7784b377cfe9c0428f7a9dd4c06415241a
BLI: add more operator overloads for float2
===================================================================
M source/blender/blenlib/BLI_float2.hh
===================================================================
diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh
index 7bf928e7db5..5fe9d1b8ca9 100644
--- a/source/blender/blenlib/BLI_float2.hh
+++ b/source/blender/blenlib/BLI_float2.hh
@@ -48,6 +48,34 @@ struct float2 {
return &x;
}
+ float2 &operator+=(const float2 &other)
+ {
+ x += other.x;
+ y += other.y;
+ return *this;
+ }
+
+ float2 &operator-=(const float2 &other)
+ {
+ x -= other.x;
+ y -= other.y;
+ return *this;
+ }
+
+ float2 &operator*=(float factor)
+ {
+ x *= factor;
+ y *= factor;
+ return *this;
+ }
+
+ float2 &operator/=(float divisor)
+ {
+ x /= divisor;
+ y /= divisor;
+ return *this;
+ }
+
friend float2 operator+(const float2 &a, const float2 &b)
{
return {a.x + b.x, a.y + b.y};
More information about the Bf-blender-cvs
mailing list