-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvector2.h
More file actions
31 lines (30 loc) · 991 Bytes
/
vector2.h
File metadata and controls
31 lines (30 loc) · 991 Bytes
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
#ifndef VECTOR2_H
#define VECTOR2_H
#include <tuple>
#include <vector>
#include <math.h>
class Vector2
{
public:
Vector2();
Vector2(float x, float y);
Vector2(std::tuple<float,float> vec);
const Vector2 operator + (const Vector2 &f)const;
const Vector2 operator - (const Vector2 &f)const;
const Vector2 operator * (const Vector2 &f)const;
const Vector2 operator * (const float &f)const;
const Vector2 operator / (const Vector2 &f)const;
bool operator == (const Vector2 &f)const;
bool operator < (const Vector2 &f)const;
bool operator > (const Vector2 &f)const;
void printVector2()const;
const Vector2 normalized()const;
void normalize();
static float distance(Vector2 &from,Vector2 &to);
static Vector2 makePositive(const Vector2 &in);
static Vector2 randomVec(const Vector2 &min,const Vector2 &max);
static bool compareVecInt(const Vector2 &in1, const Vector2 & in2);
float x;
float y;
};
#endif // VECTOR2_H