Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // TESTED
- inline TVector2<T>& operator= (const TVector2<T>& other) { x = other.x; y = other.y; return *this; }
- // TESTED
- inline TVector2<T>& operator+= (const TVector2<T>& other) { x += other.x; y += other.y; return *this; }
- // TESTED
- inline TVector2<T>& operator-= (const TVector2<T>& other) { x -= other.x; y -= other.y; return *this; }
- // TESTED
- inline TVector2<T>& operator*= (const TVector2<T>& other) { x *= other.x; y *= other.y; return *this; }
- inline TVector2<T>& operator/= (const TVector2<T>& other) { x /= other.x; y /= other.y; return *this; }
- inline TVector2<T>& operator*= (const float& other) { x *= other; y *= other; return *this; }
- inline TVector2<T>& operator/= (const float& other) { x /= other; y /= other; return *this; }
- // Unary operators
- inline TVector2<T> operator+ () const { return *this; }
- inline TVector2<T> operator- () const { return TVector2<T>(-x, -y); }
- // Binary operators
- inline TVector2<T> operator+ (const TVector2<T>& other) const { return TVector2<T>(x + other.x, y + other.y); }
- inline TVector2<T> operator- (const TVector2<T>& other) const { return TVector2<T>(x - other.x, y - other.y); }
- inline TVector2<T> operator* (const TVector2<T>& other) const { return TVector2<T>(x * other.x, y * other.y); }
- inline TVector2<T> operator/ (const TVector2<T>& other) const { return TVector2<T>(x / other.x, y / other.y); }
- inline TVector2<T> operator+ (const float& other) const { return TVector2<T>(x + other, y + other); }
- inline TVector2<T> operator- (const float& other) const { return TVector2<T>(x - other, y - other); }
- inline TVector2<T> operator* (const float& other) const { return TVector2<T>(x * other, y * other); }
- inline TVector2<T> operator/ (const float& other) const { return TVector2<T>(x / other, y / other); }
- // Boolean operators
- inline bool operator== (const TVector2<T>& other) const { return x == other.x && y == other.y; }
- inline bool operator!= (const TVector2<T>& other) const { return x != other.x && y != other.y; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement