2017-04-08 17:37:20 +00:00
|
|
|
/// @ref core
|
|
|
|
/// @file glm/detail/func_geometric.inl
|
|
|
|
|
|
|
|
#include <limits>
|
|
|
|
|
|
|
|
namespace glm {
|
|
|
|
namespace detail
|
|
|
|
{
|
2017-08-15 23:22:50 +00:00
|
|
|
template<typename T, qualifier Q, bool Aligned>
|
2017-04-08 17:37:20 +00:00
|
|
|
struct compute_cross_vec2
|
|
|
|
{
|
2017-08-15 23:22:50 +00:00
|
|
|
GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u)
|
2017-04-08 17:37:20 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
|
|
2017-08-15 23:22:50 +00:00
|
|
|
template<typename T, qualifier Q>
|
|
|
|
GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y)
|
2017-04-08 17:37:20 +00:00
|
|
|
{
|
2017-08-15 23:22:50 +00:00
|
|
|
return detail::compute_cross_vec2<T, Q, detail::is_aligned<Q>::value>::call(x, y);
|
2017-04-08 17:37:20 +00:00
|
|
|
}
|
|
|
|
}//namespace glm
|
|
|
|
|