-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgeom.h
72 lines (59 loc) · 1.35 KB
/
geom.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
namespace geom
{
enum IdentityTag
{
Identity
};
struct Point
{
Point() :
m_x(0.0f), m_y(0.0f), m_z(0.0f)
{ ; }
Point(float x, float y, float z) :
m_x(x), m_y(y), m_z(z)
{ ; }
float m_x;
float m_y;
float m_z;
};
float getDistance(Point point, Point otherPoint);
float getDistanceToLineSegment(Point point, Point segmentStart, Point segmentStop);
struct Vector
{
Vector() :
m_x(0.0f), m_y(0.0f), m_z(0.0f)
{ ; }
Vector(float x, float y, float z) :
m_x(x), m_y(y), m_z(z)
{ ; }
float getLength() const;
float m_x;
float m_y;
float m_z;
};
struct Matrix
{
Matrix()
{ ; }
Matrix(IdentityTag)
{ ; }
bool isZero() const
{ return false; }
bool isIdentity() const
{ return false; }
};
struct Sphere
{
};
Matrix Invert(const Matrix & matrix);
Vector operator * (float value, Vector vector);
Point operator * (float value, Point point);
Point & operator *= (Point & point, const Matrix & matrix);
Vector operator + (Vector vector, Vector otherVector);
Point operator + (Point point, Vector vector);
Point operator + (Point point, Point otherPoint);
Vector operator - (Point point, Vector vector);
Vector operator - (Point point, Point otherPoint);
float dotProduct(Vector vector, Vector otherVector);
};