Files
ss/include/m/m_angle.h
T
Elijah Thomas 26af4db82d update from dtk-template - clangd :) (#66)
* update from dtk-template and start work towards using clangd

* include <a> -> "a"

* Update build.yml

* remove/add non-trivial class in union warning
2024-10-16 15:36:02 -04:00

71 lines
1.1 KiB
C++

#ifndef M_ANGLE_H
#define M_ANGLE_H
#include "common.h"
#include "nw4r/math/math_triangular.h"
struct mAng {
mAng() {}
mAng(s16 s) : mVal(s) {}
mAng(const mAng &other) : mVal(other.mVal) {}
operator s16() const {
return mVal;
}
mAng operator-() {
return mAng(-mVal);
}
mAng operator+(const mAng &other) const {
return mAng(mVal + other.mVal);
}
mAng &operator+=(const mAng &other) {
mVal += other.mVal;
return *this;
}
s32 step(s16 target, s32 steps, s16 max, s16 min);
f32 sin() const {
return nw4r::math::SinIdx(*this);
}
f32 cos() const {
return nw4r::math::CosIdx(*this);
}
s16 mVal;
};
class mAng3_c {
public:
mAng3_c() {}
mAng3_c(s16 fx, s16 fy, s16 fz) : x(fx), y(fy), z(fz) {}
mAng3_c(const mAng3_c &r) {
*this = r;
}
mAng3_c &operator=(const mAng3_c &r) {
x = r.x;
y = r.y;
z = r.z;
return *this;
}
void set(s16 fx, s16 fy, s16 fz) {
x = fx;
y = fy;
z = fz;
}
mAng x, y, z;
static mAng3_c Zero;
};
#endif