mirror of
https://github.com/BlackMATov/vmath.hpp.git
synced 2025-12-16 22:19:51 +07:00
vector: rotate_x, rotate_y, rotate_z ext functions
This commit is contained in:
@@ -645,6 +645,21 @@ namespace vmath_hpp
|
||||
v.x * s + v.y * c};
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
[[nodiscard]] vec<T, 3> rotate_x(const vec<T, 3>& v, T angle) {
|
||||
return v * qrotate(angle, unit3_x<T>);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
[[nodiscard]] vec<T, 3> rotate_y(const vec<T, 3>& v, T angle) {
|
||||
return v * qrotate(angle, unit3_y<T>);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
[[nodiscard]] vec<T, 3> rotate_z(const vec<T, 3>& v, T angle) {
|
||||
return v * qrotate(angle, unit3_z<T>);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
[[nodiscard]] vec<T, 3> rotate(const vec<T, 3>& v, const qua<T>& q) {
|
||||
return v * q;
|
||||
@@ -655,6 +670,21 @@ namespace vmath_hpp
|
||||
return v * qrotate(angle, axis);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
[[nodiscard]] vec<T, 4> rotate_x(const vec<T, 4>& v, T angle) {
|
||||
return v * qrotate(angle, unit3_x<T>);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
[[nodiscard]] vec<T, 4> rotate_y(const vec<T, 4>& v, T angle) {
|
||||
return v * qrotate(angle, unit3_y<T>);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
[[nodiscard]] vec<T, 4> rotate_z(const vec<T, 4>& v, T angle) {
|
||||
return v * qrotate(angle, unit3_z<T>);
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
[[nodiscard]] vec<T, 4> rotate(const vec<T, 4>& v, const qua<T>& q) {
|
||||
return v * q;
|
||||
|
||||
Reference in New Issue
Block a user