diff options
Diffstat (limited to 'point.h')
| -rw-r--r-- | point.h | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/point.h b/point.h deleted file mode 100644 index 36cfda9..0000000 --- a/point.h +++ /dev/null @@ -1,87 +0,0 @@ -// -// Created by saintruler on 11.04.19. -// - -#ifndef OPENGLTEST_POINT_H -#define OPENGLTEST_POINT_H - -#include <cmath> - -class point -{ -public: - point(double x, double y) - { - this->x = x; - this->y = y; - } - - friend point operator+(const point& left, const point& right) - { - return point(left.x + right.x, left.y + right.y); - } - - friend point operator+=(point& left, const point& right) - { - left.x += right.x; - left.y += right.y; - return left; - } - - friend point operator-(const point& left, const point& right) - { - return point(left.x - right.x, left.y - right.y); - } - - friend point operator-=(point& left, const double right) - { - left.x -= right; - left.y -= right; - return left; - } - - friend point operator/(const point& left, const double right) - { - return point(left.x / right, left.y / right); - } - - friend point operator/=(point& left, const double right) - { - left.x /= right; - left.y /= right; - return left; - } - - friend point operator*(const point& left, const double right) - { - return point(left.x * right, left.y * right); - } - - friend point operator*=(point& left, const double right) - { - left.x *= right; - left.y *= right; - return left; - } - - double length() - { - return sqrt(pow(x, 2) + pow(y, 2)); - } - - double length_sqared() - { - return pow(x, 2) + pow(y, 2); - } - - void normalize() - { - const double l = length(); - this->x /= l; - this->y /= l; - } - - double x, y; -}; - -#endif //OPENGLTEST_POINT_H |