exterior_product.inl 633 B

1234567891011121314151617181920212223242526
  1. /// @ref gtx_exterior_product
  2. #include <limits>
  3. namespace glm {
  4. namespace detail
  5. {
  6. template<typename T, qualifier Q, bool Aligned>
  7. struct compute_cross_vec2
  8. {
  9. GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u)
  10. {
  11. GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' accepts only floating-point inputs");
  12. return v.x * u.y - u.x * v.y;
  13. }
  14. };
  15. }//namespace detail
  16. template<typename T, qualifier Q>
  17. GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y)
  18. {
  19. return detail::compute_cross_vec2<T, Q, detail::is_aligned<Q>::value>::call(x, y);
  20. }
  21. }//namespace glm