-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvec3.h
48 lines (42 loc) · 895 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
48
#ifndef VEC3_H
# define VEC3_H
#include "vec3.h"
class Vec3 {
public:
float x;
float y;
float z;
void normalize();
Vec3 norm();
float mag();
Vec3 copy();
void rotateY(float theta);
static Vec3 cross(Vec3 a, Vec3 b);
float dot(Vec3 v);
float dist(Vec3 v);
float dist2(Vec3 v);
Vec3 operator+(Vec3 v);
Vec3 operator-(Vec3 v);
Vec3 operator+(float f);
Vec3 operator-(float f);
Vec3 operator*(float f);
Vec3 operator/(float f);
void operator=(Vec3 v);
void operator=(float f);
void operator+=(Vec3 v);
void operator-=(Vec3 v);
void operator+=(float f);
void operator-=(float f);
void operator*=(float f);
void operator/=(float f);
Vec3(float x, float y, float z);
Vec3();
};
class Ray {
public:
Vec3 pos;
Vec3 dir;
Ray(Vec3 origin, Vec3 direction);
Ray();
};
#endif