Lines Matching refs:Vector2

15 class Vector2 {
17 Vector2(float x, float y) : x(x), y(y) { print_created(this, toString()); }
18 Vector2(const Vector2 &v) : x(v.x), y(v.y) { print_copy_created(this); }
19 Vector2(Vector2 &&v) : x(v.x), y(v.y) { print_move_created(this); v.x = v.y = 0; }
20 Vector2 &operator=(const Vector2 &v) { x = v.x; y = v.y; print_copy_assigned(this); return *this; }
21 Vector2 &operator=(Vector2 &&v) { x = v.x; y = v.y; v.x = v.y = 0; print_move_assigned(this); return *this; }
22 ~Vector2() { print_destroyed(this); }
26 Vector2 operator-() const { return Vector2(-x, -y); }
27 Vector2 operator+(const Vector2 &v) const { return Vector2(x + v.x, y + v.y); }
28 Vector2 operator-(const Vector2 &v) const { return Vector2(x - v.x, y - v.y); }
29 Vector2 operator-(float value) const { return Vector2(x - value, y - value); }
30 Vector2 operator+(float value) const { return Vector2(x + value, y + value); }
31 Vector2 operator*(float value) const { return Vector2(x * value, y * value); }
32 Vector2 operator/(float value) const { return Vector2(x / value, y / value); }
33 Vector2 operator*(const Vector2 &v) const { return Vector2(x * v.x, y * v.y); }
34 Vector2 operator/(const Vector2 &v) const { return Vector2(x / v.x, y / v.y); }
35 Vector2& operator+=(const Vector2 &v) { x += v.x; y += v.y; return *this; }
36 Vector2& operator-=(const Vector2 &v) { x -= v.x; y -= v.y; return *this; }
37 Vector2& operator*=(float v) { x *= v; y *= v; return *this; }
38 Vector2& operator/=(float v) { x /= v; y /= v; return *this; }
39 Vector2& operator*=(const Vector2 &v) { x *= v.x; y *= v.y; return *this; }
40 Vector2& operator/=(const Vector2 &v) { x /= v.x; y /= v.y; return *this; }
42 friend Vector2 operator+(float f, const Vector2 &v) { return Vector2(f + v.x, f + v.y); }
43 friend Vector2 operator-(float f, const Vector2 &v) { return Vector2(f - v.x, f - v.y); }
44 friend Vector2 operator*(float f, const Vector2 &v) { return Vector2(f * v.x, f * v.y); }
45 friend Vector2 operator/(float f, const Vector2 &v) { return Vector2(f / v.x, f / v.y); }
60 struct hash<Vector2> {
62 size_t operator()(const Vector2 &) { return 4; }
88 py::class_<Vector2>(m, "Vector2")
109 .def("__str__", &Vector2::toString)
113 m.attr("Vector") = m.attr("Vector2");