less translate function variants

This commit is contained in:
BlackMATov
2021-02-27 06:22:33 +07:00
parent 9c70e2d40c
commit e06d009cdb
3 changed files with 4 additions and 40 deletions

View File

@@ -1799,12 +1799,6 @@ qua<T> imag(qua<T> q, const vec<T, 3>& imag);
### Matrix Transform 3D
```cpp
template < typename T >
mat<T, 4> translate(T x, T y, T z);
template < typename T >
mat<T, 4> translate(const mat<T, 4>& m, T x, T y, T z);
template < typename T >
mat<T, 4> translate(const vec<T, 3>& v);
@@ -1869,12 +1863,6 @@ mat<T, 4> look_at_rh(const vec<T, 3>& eye, const vec<T, 3>& at, const vec<T, 3>&
### Matrix Transform 2D
```cpp
template < typename T >
mat<T, 3> translate(T x, T y);
template < typename T >
mat<T, 3> translate(const mat<T, 3>& m, T x, T y);
template < typename T >
mat<T, 3> translate(const vec<T, 2>& v);

View File

@@ -233,7 +233,7 @@ namespace vmath_hpp
// translate
template < typename T >
[[nodiscard]] constexpr mat<T, 4> translate(T x, T y, T z) {
[[nodiscard]] constexpr mat<T, 4> translate(const vec<T, 3>& v) {
/// REFERENCE:
/// https://en.wikipedia.org/wiki/Translation_(geometry)
@@ -241,17 +241,7 @@ namespace vmath_hpp
{ T{1}, T{0}, T{0}, T{0} },
{ T{0}, T{1}, T{0}, T{0} },
{ T{0}, T{0}, T{1}, T{0} },
{ x, y, z, T{1} }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> translate(const mat<T, 4>& m, T x, T y, T z) {
return m * translate(x, y, z);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 4> translate(const vec<T, 3>& v) {
return translate(v.x, v.y, v.z);
{ v.x, v.y, v.z, T{1} }};
}
template < typename T >
@@ -519,24 +509,14 @@ namespace vmath_hpp
// translate
template < typename T >
[[nodiscard]] constexpr mat<T, 3> translate(T x, T y) {
[[nodiscard]] constexpr mat<T, 3> translate(const vec<T, 2>& v) {
/// REFERENCE:
/// https://en.wikipedia.org/wiki/Translation_(geometry)
return {
{ T{1}, T{0}, T{0} },
{ T{0}, T{1}, T{0} },
{ x, y, T{1} }};
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> translate(const mat<T, 3>& m, T x, T y) {
return m * translate(x, y);
}
template < typename T >
[[nodiscard]] constexpr mat<T, 3> translate(const vec<T, 2>& v) {
return translate(v.x, v.y);
{ v.x, v.y, T{1} }};
}
template < typename T >

View File

@@ -383,8 +383,6 @@ namespace vmath_hpp
namespace vmath_hpp
{
template fix4x4f translate(fix<float> x, fix<float> y, fix<float> z);
template fix4x4f translate(const fix4x4f&, fix<float>, fix<float>, fix<float>);
template fix4x4f translate(const fix3f&);
template fix4x4f translate(const fix4x4f&, const fix3f&);
@@ -420,8 +418,6 @@ namespace vmath_hpp
namespace vmath_hpp
{
template fix3x3f translate(fix<float>, fix<float>);
template fix3x3f translate(const fix3x3f&, fix<float>, fix<float>);
template fix3x3f translate(const fix2f&);
template fix3x3f translate(const fix3x3f&, const fix2f&);