blob: 5c9dbfda411a0feacf404d10fcdc3a38460f18fe (
plain)
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
|
#ifndef D_VEC_H
#define D_VEC_H
#include "m/m_angle.h"
#include "m/m_vec.h"
/**
* @brief Gets a point on a XZ circle.
*
* @param center the circle center. Will also hold the result.
* @param angle the Y angle.
* @param radius the circle radius.
*/
inline static void getXZCirclePoint(mVec3_c ¢er, const mAng &angle, f32 radius) {
center.x += radius * angle.sin();
center.z += radius * angle.cos();
}
/**
* @brief Converts a 2D vector to a 3D vector holding the original's vector coordinates in its XY components.
*
* @param v The 2D vector
* @return mVec3_c The 3D vector
*/
inline mVec3_c vec2ToVec3XY(const mVec2_c &v) {
return mVec3_c(v.x, v.y, 0.0f);
}
/**
* @brief Computes left x right
*
* @param result the result
* @param left left operant
* @param right right operand
*/
inline void vecCross(mVec3_c &result, const mVec3_c &left, const mVec3_c &right) {
result.set(
(left.y * right.z) - (left.z * right.y), (left.z * right.x) - (left.x * right.z),
(left.x * right.y) - (left.y * right.x)
);
}
#endif
|