-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVector2D.h
44 lines (32 loc) · 826 Bytes
/
Vector2D.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include <utility>
class Vector2D
{
public:
float x;
float y;
Vector2D() = default;
Vector2D(const float x, const float y) noexcept;
Vector2D operator+(const Vector2D& vector);
Vector2D operator-(const Vector2D& vector);
Vector2D& operator+=(const Vector2D& vector);
Vector2D& operator-=(const Vector2D& vector);
Vector2D operator*(const float scalar);
void normalize();
void rotate(const Vector2D& center, const float angle);
float getAngle() const;
};
class Size
{
public:
int width;
int height;
Size() = default;
Size(const int width, const int height) noexcept;
};
using Position = Vector2D;
using Delta = Vector2D;
using Direction = Vector2D;
using Angle = float;
using Seed = int;
using BoundingBox = std::pair<Vector2D, Vector2D>;