clean up ext api

This commit is contained in:
BlackMATov
2021-02-27 07:53:16 +07:00
parent ebdcb4f495
commit b8cb43c454
4 changed files with 1 additions and 292 deletions

View File

@@ -274,11 +274,6 @@ namespace vmath_hpp
{ v.x, v.y, v.z, T{1} }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> translate(const mat<T, 4>& m, const vec<T, 3>& v) {
return m * translate(v);
}
// rotate
template < typename T >
@@ -310,21 +305,11 @@ namespace vmath_hpp
{ (xz2 + sy2), (yz2 - sx2), T{1} - (xx2 + yy2) }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> rotate(const mat<T, 3>& m, const qua<T>& q) {
return m * rotate(q);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4(const qua<T>& q) {
return mat<T, 4>(rotate(q));
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4(const mat<T, 4>& m, const qua<T>& q) {
return m * rotate4(q);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> rotate(T angle, const vec<T, 3>& axis) {
/// REFERENCE:
@@ -357,21 +342,11 @@ namespace vmath_hpp
{ xzm + ys, yzm - xs, zzm + c }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> rotate(const mat<T, 3>& m, T angle, const vec<T, 3>& axis) {
return m * rotate(angle, axis);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4(T angle, const vec<T, 3>& axis) {
return mat<T, 4>(rotate(angle, axis));
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4(const mat<T, 4>& m, T angle, const vec<T, 3>& axis) {
return m * rotate4(angle, axis);
}
// rotate_x
template < typename T >
@@ -387,21 +362,11 @@ namespace vmath_hpp
{ T{0}, -s, c }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> rotate_x(const mat<T, 3>& m, T angle) {
return m * rotate_x(angle);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4_x(T angle) {
return mat<T, 4>(rotate_x(angle));
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4_x(const mat<T, 4>& m, T angle) {
return m * rotate4_x(angle);
}
// rotate_y
template < typename T >
@@ -417,21 +382,11 @@ namespace vmath_hpp
{ s, T{0}, c }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> rotate_y(const mat<T, 3>& m, T angle) {
return m * rotate_y(angle);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4_y(T angle) {
return mat<T, 4>(rotate_y(angle));
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4_y(const mat<T, 4>& m, T angle) {
return m * rotate4_y(angle);
}
// rotate_z
template < typename T >
@@ -447,21 +402,11 @@ namespace vmath_hpp
{ T{0}, T{0}, T{1} }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> rotate_z(const mat<T, 3>& m, T angle) {
return m * rotate_z(angle);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4_z(T angle) {
return mat<T, 4>(rotate_z(angle));
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> rotate4_z(const mat<T, 4>& m, T angle) {
return m * rotate4_z(angle);
}
// scale
template < typename T >
@@ -475,23 +420,11 @@ namespace vmath_hpp
{ T{0}, T{0}, v.z }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> scale(const mat<T, 3>& m, const vec<T, 3>& v) {
return m * scale(v);
}
// scale4
template < typename T >
[[nodiscard]] constexpr mat<T, 4> scale4(const vec<T, 3>& v) {
return mat<T, 4>(scale(v));
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> scale4(const mat<T, 4>& m, const vec<T, 3>& v) {
return m * scale4(v);
}
// look_at
template < typename T >
@@ -616,11 +549,6 @@ namespace vmath_hpp
{ v.x, v.y, T{1} }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> translate(const mat<T, 3>& m, const vec<T, 2>& v) {
return m * translate(v);
}
// rotate
template < typename T >
@@ -635,21 +563,11 @@ namespace vmath_hpp
{ -s, c }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 2> rotate(const mat<T, 2>& m, T angle) {
return m * rotate(angle);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> rotate3(T angle) {
return mat<T, 3>(rotate(angle));
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> rotate3(const mat<T, 3>& m, T angle) {
return m * rotate3(angle);
}
// scale
template < typename T >
@@ -662,21 +580,11 @@ namespace vmath_hpp
{ T{0}, v.y }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 2> scale(const mat<T, 2>& m, const vec<T, 2>& v) {
return m * scale(v);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> scale3(const vec<T, 2>& v) {
return mat<T, 3>(scale(v));
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> scale3(const mat<T, 3>& m, const vec<T, 2>& v) {
return m * scale3(v);
}
// shear
template < typename T >
@@ -689,20 +597,10 @@ namespace vmath_hpp
{ v.x, T{1} }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 2> shear(const mat<T, 2>& m, const vec<T, 2>& v) {
return m * shear(v);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> shear3(const vec<T, 2>& v) {
return mat<T, 3>(shear(v));
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> shear3(const mat<T, 3>& m, const vec<T, 2>& v) {
return m * shear3(v);
}
}
//
@@ -927,11 +825,6 @@ namespace vmath_hpp
return v * qrotate(angle, unit3_z<T>);
}
template < typename T >
[[nodiscard]] constexpr vec<T, 3> rotate(const vec<T, 3>& v, const qua<T>& q) {
return v * q;
}
template < typename T >
[[nodiscard]] constexpr vec<T, 3> rotate(const vec<T, 3>& v, T angle, const vec<T, 3>& axis) {
return v * qrotate(angle, axis);
@@ -978,11 +871,6 @@ namespace vmath_hpp
T{1}}));
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate(const qua<T>& q, const mat<T, 3>& m) {
return q * qrotate(m);
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate(const vec<T, 3>& from, const vec<T, 3>& to) {
/// REFERENCE:
@@ -1000,11 +888,6 @@ namespace vmath_hpp
return normalize(qua{cross(from, to), s});
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate(const qua<T>& q, const vec<T, 3>& from, const vec<T, 3>& to) {
return q * qrotate(from, to);
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate(T angle, const vec<T, 3>& axis) {
/// REFERENCE:
@@ -1016,11 +899,6 @@ namespace vmath_hpp
return {vec{x, y, z} * s, c};
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate(const qua<T>& q, T angle, const vec<T, 3>& axis) {
return q * qrotate(angle, axis);
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate_x(T angle) {
/// REFERENCE:
@@ -1031,11 +909,6 @@ namespace vmath_hpp
return {vec{s, T{0}, T{0}}, c};
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate_x(const qua<T>& q, T angle) {
return qrotate(q, angle, unit3_x<T>);
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate_y(T angle) {
/// REFERENCE:
@@ -1046,11 +919,6 @@ namespace vmath_hpp
return {vec{T{0}, s, T{0}}, c};
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate_y(const qua<T>& q, T angle) {
return qrotate(q, angle, unit3_y<T>);
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate_z(T angle) {
/// REFERENCE:
@@ -1061,12 +929,7 @@ namespace vmath_hpp
return {vec{T{0}, T{0}, s}, c};
}
template < typename T >
[[nodiscard]] constexpr qua<T> qrotate_z(const qua<T>& q, T angle) {
return qrotate(q, angle, unit3_z<T>);
}
// look_at
// qlook_at
template < typename T >
[[nodiscard]] constexpr qua<T> qlook_at_lh(const vec<T, 3>& dir, const vec<T, 3>& up) {