qua: dot, length, length2, normalize

This commit is contained in:
BlackMATov
2021-01-26 01:57:39 +07:00
parent 341e3dd0a3
commit 4a8c69e4f4
2 changed files with 36 additions and 0 deletions

View File

@@ -167,5 +167,29 @@ namespace vmath_hpp
}
}
//
// Geometric Functions
//
namespace vmath_hpp
{
template < typename T >
[[nodiscard]] constexpr T dot(const qua<T>& xs, const qua<T>& ys) {
return dot(vec{xs}, vec{ys});
}
template < typename T >
[[nodiscard]] T length(const qua<T>& xs) {
return length(vec{xs});
}
template < typename T >
[[nodiscard]] constexpr T length2(const qua<T>& xs) {
return length2(vec{xs});
}
template < typename T >
[[nodiscard]] constexpr qua<T> normalize(const qua<T>& xs) {
return qua(normalize(vec{xs}));
}
}