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:
Diffstat (limited to 'source/blender/blenlib/BLI_float2.hh')
-rw-r--r--source/blender/blenlib/BLI_float2.hh13
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;