Created
March 5, 2019 20:14
-
-
Save Ben1980/b6ca2e79e77e67ffba3d77e633b169eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Vector2D { | |
double x; | |
double y; | |
Vector2D() : x(0), y(0) {} | |
Vector2D(double x, double y) : x(x), y(y) {} | |
bool operator==(const Vector2D &rhs) const; | |
bool operator!=(const Vector2D &rhs) const; | |
double length() const; | |
Vector2D& operator-=(const Vector2D& rhs); | |
Vector2D& operator+=(const Vector2D& rhs); | |
Vector2D& operator*=(const double& rhs); | |
Vector2D& operator/=(const double& rhs); | |
}; | |
Vector2D operator-(const Vector2D &lhs, const Vector2D &rhs); | |
Vector2D operator+(const Vector2D &lhs, const Vector2D &rhs); | |
Vector2D operator*(const Vector2D &lhs, const double &rhs); | |
Vector2D operator*(const double &lhs, const Vector2D &rhs); | |
Vector2D operator/(const Vector2D &lhs, const double &rhs); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment