-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vec2f.h
37 lines (28 loc) · 833 Bytes
/
Vec2f.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
#ifndef LTBL_VEC2F_H
#define LTBL_VEC2F_H
#include <iostream>
class Vec2f
{
public:
float x, y;
Vec2f();
Vec2f(float X, float Y);
bool operator==(const Vec2f &other) const;
Vec2f operator*(float scale) const;
Vec2f operator/(float scale) const;
Vec2f operator+(const Vec2f &other) const;
Vec2f operator-(const Vec2f &other) const;
Vec2f operator-() const;
const Vec2f &operator*=(float scale);
const Vec2f &operator/=(float scale);
const Vec2f &operator+=(const Vec2f &other);
const Vec2f &operator-=(const Vec2f &other);
float Magnitude() const;
float MagnitudeSquared() const;
Vec2f Normalize() const;
float Dot(const Vec2f &other) const;
float Cross(const Vec2f &other) const;
};
Vec2f operator*(float scale, const Vec2f &v);
std::ostream &operator<<(std::ostream &output, const Vec2f &v);
#endif