mirror of
https://github.com/g-truc/glm.git
synced 2024-12-02 12:34:35 +00:00
28 lines
657 B
C++
28 lines
657 B
C++
/// @ref core
|
|
/// @file glm/detail/func_geometric.inl
|
|
|
|
#include <limits>
|
|
|
|
namespace glm {
|
|
namespace detail
|
|
{
|
|
template<typename T, qualifier P, bool Aligned>
|
|
struct compute_cross_vec2
|
|
{
|
|
GLM_FUNC_QUALIFIER static T call(vec<2, T, P> const& v, vec<2, T, P> const& u)
|
|
{
|
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' accepts only floating-point inputs");
|
|
|
|
return v.x * u.y - u.x * v.y;
|
|
}
|
|
};
|
|
}//namespace detail
|
|
|
|
template<typename T, qualifier P>
|
|
GLM_FUNC_QUALIFIER T cross(vec<2, T, P> const& x, vec<2, T, P> const& y)
|
|
{
|
|
return detail::compute_cross_vec2<T, P, detail::is_aligned<P>::value>::call(x, y);
|
|
}
|
|
}//namespace glm
|
|
|