-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmathLib3D.h
56 lines (44 loc) · 965 Bytes
/
mathLib3D.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
#ifndef MATHLIB_3D_H
#define MATHLIB_3D_H
#include <math.h>
#include <cmath>
#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif
class Point3D {
public:
Point3D();
Point3D(float inX, float inY, float inZ);
float mX;
float mY;
float mZ;
float distanceTo(Point3D other);
float fastDistanceTo(Point3D other);
};
class Vec3D {
public:
Vec3D();
Vec3D(float inX, float inY, float inZ);
float mX;
float mY;
float mZ;
float length();
Vec3D normalize();
Vec3D multiply(float scalar);
Vec3D cross(Vec3D other);
Point3D movePoint(Point3D source);
static Vec3D createVector(Point3D p1, Point3D p2);
};
class RotationMatrix {
public:
RotationMatrix();
RotationMatrix(Vec3D axis, float angle);
void setAxis(Vec3D new_axis);
void setAngle(float new_angle);
void update();
Vec3D multiply(Vec3D tgt);
Vec3D axis;
float angle;
float matrix[3][3];
};
#endif