summaryrefslogtreecommitdiff
path: root/src/helpers/Vector2D.cpp
blob: 33b12e7cebdafd19ecc1df8e29a8bd546c5f7953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "Vector2D.hpp"

Vector2D::Vector2D(double xx, double yy) {
    x = xx;
    y = yy;
}

Vector2D::Vector2D() { x = 0; y = 0; }
Vector2D::~Vector2D() {}

double Vector2D::normalize() {
    // get max abs
    const auto max = abs(x) > abs(y) ? abs(x) : abs(y);

    x /= max;
    y /= max;

    return max;
}