diff options
Diffstat (limited to 'source/blender/blenlib/BLI_float2.hh')
-rw-r--r-- | source/blender/blenlib/BLI_float2.hh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh index 2a5320e4c35..84dd0e358a2 100644 --- a/source/blender/blenlib/BLI_float2.hh +++ b/source/blender/blenlib/BLI_float2.hh @@ -29,6 +29,14 @@ struct float2 { { } + explicit float2(float value) : x(value), y(value) + { + } + + explicit float2(int value) : x(value), y(value) + { + } + float2(float x, float y) : x(x), y(y) { } @@ -52,6 +60,11 @@ struct float2 { return len_v2(*this); } + float length_squared() const + { + return len_squared_v2(*this); + } + float2 &operator+=(const float2 &other) { x += other.x; |