-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvec3.h
32 lines (24 loc) · 772 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
#ifndef __VEC3_H__
#define __VEC3_H__
#include <iostream>
class vec3 {
public:
double x, y, z;
vec3();
vec3(double value);
vec3(double x_, double y_, double z_);
vec3(const vec3& other);
vec3 operator+(const vec3& other);
vec3 operator-(const vec3& other);
vec3 operator*(double t);
vec3 operator/(double t);
static double dot(const vec3& v1, const vec3& v2);
double length();
double squared_length();
vec3 normalize();
static vec3 cross(const vec3& v1, const vec3& v2);
};
std::ostream& operator <<(std::ostream& stream, const vec3& v);
vec3 operator*(const vec3& v1, const vec3& v2);
vec3 operator+(const vec3& v1, const vec3& v2);
#endif