-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vector.h
33 lines (27 loc) · 856 Bytes
/
Vector.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
#ifndef __SimpleRayTracer__vector__
#define __SimpleRayTracer__vector__
#include <iostream>
#define EPSILON 1e-6
class Vector
{
public:
float X;
float Y;
float Z;
Vector( float x, float y, float z);
Vector();
float dot(const Vector& v) const;
Vector cross(const Vector& v) const;
Vector operator+(const Vector& v) const;
Vector operator-(const Vector& v) const;
Vector& operator+=(const Vector& v);
Vector operator*(float c) const;
Vector operator-() const;
Vector& normalize();
float length() const;
float lengthSquared() const;
Vector reflection( const Vector& normal) const;
bool triangleIntersection( const Vector& d, const Vector& a, const Vector& b,
const Vector& c, float& s) const;
};
#endif /* defined(__SimpleRayTracer__vector__) */