-
Notifications
You must be signed in to change notification settings - Fork 0
/
vec.h
64 lines (35 loc) · 929 Bytes
/
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
#ifndef _VEC_H_
#define _VEC_H_
#include <math.h>
#include <iostream>
class Vec
{
private:
public:
float x, y, z;
Vec();
Vec(float a);
Vec(float a, float b);
Vec(float a, float b, float c);
Vec(const Vec &v);
float& operator[] (const int index);
Vec operator+(const Vec &v);
Vec operator-(const Vec &v);
Vec operator-();
Vec operator*(const float &f);
Vec operator/(const float &f);
Vec& operator=(const Vec &vSource);
friend Vec operator*(float f, Vec v);
friend Vec operator/(float f, Vec v);
float Magnitude();
float Dot(Vec b);
Vec Cross(Vec b);
Vec Norm();
Vec Normalize();
void Print();
};
Vec Normal(Vec a, Vec b);
Vec Normal(Vec a, Vec b, Vec c);
float Dot(Vec a, Vec b);
Vec Cross(Vec a, Vec b);
#endif