-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvec.h
73 lines (62 loc) · 1.4 KB
/
vec.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once
#define CHECK_VALID(_v) 0
#define Assert( _exp ) ((void)0)
struct Vector2
{
public:
float x;
float y;
Vector2 operator-(const Vector2& rhs) const;
float lenght();
Vector2(float x, float y);
Vector2();
};
struct Vector3
{
public:
Vector3();
Vector3(float x, float y, float z);
Vector3 operator-(const Vector3& rhs) const;
Vector3 operator-=(const Vector3& rhs) const;
Vector3 operator+(const Vector3& rhs) const;
Vector3 operator*(const Vector3& rhs) const;
Vector3 operator/(const Vector3& rhs) const;
Vector3 operator+=(const Vector3& rhs) const;
Vector3 operator*=(const Vector3& rhs) const;
Vector3 operator/=(const Vector3& rhs) const;
Vector3 operator+(const float& rhs) const;
Vector3 operator-(const float& rhs) const;
Vector3 operator/(const float& rhs) const;
Vector3 operator*(const float& rhs) const;
float distance(Vector3 vector);
Vector3 Zero();
float Dot(const Vector3& rhs) const;
bool IsZero()const;
float distance_to(const Vector3& other);
float length();
public:
float x;
float y;
float z;
};
struct Vector4
{
public:
float x;
float y;
float z;
float w;
Vector4 Zero();
};
struct Matrix3x4
{
float m[3][4];
};
struct Matrix4x3
{
float m[4][3];
};
struct Matrix4x4
{
union { Vector4 v[4]; float m[4][4]; struct { Vector4 right; Vector4 up; Vector4 forward; Vector4 trans; }; };
};