Move apply_rotation_xyz into matrix_3x3

This commit is contained in:
Scott Lahteine
2021-03-30 23:16:29 -05:00
committed by Scott Lahteine
parent 8d083eb248
commit be775ed72d
5 changed files with 10 additions and 12 deletions

View File

@ -87,8 +87,8 @@ void vector_3::debug(PGM_P const title) {
* matrix_3x3
*/
void apply_rotation_xyz(const matrix_3x3 &matrix, float &_x, float &_y, float &_z) {
vector_3 vec = vector_3(_x, _y, _z); vec.apply_rotation(matrix);
void matrix_3x3::apply_rotation_xyz(float &_x, float &_y, float &_z) {
vector_3 vec = vector_3(_x, _y, _z); vec.apply_rotation(*this);
_x = vec.x; _y = vec.y; _z = vec.z;
}

View File

@ -45,7 +45,6 @@
class matrix_3x3;
struct vector_3 : xyz_float_t {
vector_3(const float &_x, const float &_y, const float &_z) { set(_x, _y, _z); }
vector_3(const xy_float_t &in) { set(in.x, in.y); }
vector_3(const xyz_float_t &in) { set(in.x, in.y, in.z); }
@ -82,9 +81,8 @@ struct matrix_3x3 {
void set_to_identity();
void debug(PGM_P const title);
};
void apply_rotation_xyz(const matrix_3x3 &rotationMatrix, float &x, float &y, float &z);
FORCE_INLINE void apply_rotation_xyz(const matrix_3x3 &rotationMatrix, xyz_pos_t &pos) {
apply_rotation_xyz(rotationMatrix, pos.x, pos.y, pos.z);
}
void apply_rotation_xyz(float &x, float &y, float &z);
FORCE_INLINE void apply_rotation_xyz(xyz_pos_t &pos) { apply_rotation_xyz(pos.x, pos.y, pos.z); }
};