summaryrefslogtreecommitdiff
path: root/include/d/d_vec.h
blob: 18fdd62889f5e4f781e608d87dcb51a11fdfae3f (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
#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 &center, 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);
}

#endif