Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_float2.hh
| Show All 23 Lines | struct float2 { | ||||
| float x, y; | float x, y; | ||||
| float2() = default; | float2() = default; | ||||
| float2(const float *ptr) : x{ptr[0]}, y{ptr[1]} | float2(const float *ptr) : x{ptr[0]}, y{ptr[1]} | ||||
| { | { | ||||
| } | } | ||||
| 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) | float2(float x, float y) : x(x), y(y) | ||||
| { | { | ||||
| } | } | ||||
| float2(const float3 &other) : x(other.x), y(other.y) | float2(const float3 &other) : x(other.x), y(other.y) | ||||
| { | { | ||||
| } | } | ||||
| operator float *() | operator float *() | ||||
| { | { | ||||
| return &x; | return &x; | ||||
| } | } | ||||
| operator const float *() const | operator const float *() const | ||||
| { | { | ||||
| return &x; | return &x; | ||||
| } | } | ||||
| float length() const | float length() const | ||||
| { | { | ||||
| return len_v2(*this); | return len_v2(*this); | ||||
| } | } | ||||
| float length_squared() const | |||||
| { | |||||
| return len_squared_v2(*this); | |||||
| } | |||||
| float2 &operator+=(const float2 &other) | float2 &operator+=(const float2 &other) | ||||
| { | { | ||||
| x += other.x; | x += other.x; | ||||
| y += other.y; | y += other.y; | ||||
| return *this; | return *this; | ||||
| } | } | ||||
| float2 &operator-=(const float2 &other) | float2 &operator-=(const float2 &other) | ||||
| ▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines | |||||