-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMathTools.cpp
More file actions
29 lines (22 loc) · 817 Bytes
/
MathTools.cpp
File metadata and controls
29 lines (22 loc) · 817 Bytes
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
#include "MathTools.h"
MathTools::MathTools(AIRealMathSuite *realMathSuite) {
sAIRealMath = realMathSuite;
}
MathTools::~MathTools() {
sAIRealMath = nullptr;
}
AIRealPoint MathTools::RadianToVector2(AIReal radian) {
return { sAIRealMath->AIRealCos(radian), sAIRealMath->AIRealSin(radian) };
}
AIRealPoint MathTools::RadianToVector2(AIReal radian, AIReal length) {
AIRealPoint vector2 = this->RadianToVector2(radian);
return { vector2.h * length, vector2.v * length };
}
AIRealPoint MathTools::DegreeToVector2(AIReal degree) {
AIRealPoint vector2 = this->RadianToVector2(sAIRealMath->DegreeToRadian(degree));
return vector2;
}
AIRealPoint MathTools::DegreeToVector2(AIReal degree, AIReal length) {
AIRealPoint vector2 = this->DegreeToVector2(degree);
return { vector2.h*length, vector2.v * length };
}