-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvec3.h
47 lines (32 loc) · 823 Bytes
/
vec3.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
#ifndef VEC3_H_
#define VEC3_H_
class Vec3 {
public:
Vec3();
Vec3(float a);
Vec3(float x, float y, float z);
float x() const;
float y() const;
float z() const;
float r() const;
float g() const;
float b() const;
float length() const;
Vec3 sqrt() const;
Vec3& operator*=(float f);
Vec3& operator+=(Vec3 const& v);
private:
float x_;
float y_;
float z_;
};
float dot(const Vec3& v1, const Vec3& v2);
Vec3 unit_vector(const Vec3& v);
Vec3 lerp(const Vec3& v1, const Vec3& v2, float t);
Vec3 operator*(float t, const Vec3& v);
Vec3 operator*(const Vec3& v, float t);
Vec3 operator*(const Vec3& v1, const Vec3& v2);
Vec3 operator+(const Vec3& v1, const Vec3& v2);
Vec3 operator-(const Vec3& v1, const Vec3& v2);
Vec3 operator-(const Vec3& v);
#endif