-
Notifications
You must be signed in to change notification settings - Fork 3
/
Vector.h
36 lines (25 loc) · 927 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
34
35
36
#ifndef _Vector_
#define _Vector_
#include "bool.h"
extern const float vEpsilon;
typedef struct {
float x, y, z;
} Vector;
Vector makeVector(const float x, const float y, const float z);
Vector makeVectorOrigo();
bool vEqual(const Vector a, const Vector b);
Vector vAdd (const Vector a, const Vector b);
Vector vSub (const Vector a, const Vector b);
Vector vsMul(const Vector v, const float s);
Vector vsDiv(const Vector v, const float s);
float vDot (const Vector a, const Vector b);
Vector vCross(const Vector a, const Vector b);
float vLength (const Vector v);
float vLengthSquared(const Vector v);
Vector vNormalized (const Vector v);
Vector vNegated (const Vector v);
Vector vTangent (const Vector normal);
Vector vRotated(const Vector v, const Vector axis, const float angle);
Vector vReflected(const Vector v, const Vector normal);
Vector vSampleHemisphere(const Vector normal);
#endif