mirror of
https://github.com/g-truc/glm.git
synced 2025-04-15 01:18:14 +00:00
Add areCollinear overload for three points
This commit is contained in:
parent
e6426d5820
commit
4b9b39f1db
2 changed files with 19 additions and 1 deletions
|
@ -44,6 +44,8 @@
|
|||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
#include "../gtx/area.hpp"
|
||||
#include "../gtc/epsilon.hpp"
|
||||
#include "../gtc/constants.hpp"
|
||||
#include <cfloat>
|
||||
#include <limits>
|
||||
|
||||
|
@ -60,7 +62,12 @@ namespace glm
|
|||
/// @see gtx_vector_query extensions.
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL bool areCollinear(vecType<T, P> const & v0, vecType<T, P> const & v1, T const & epsilon);
|
||||
|
||||
|
||||
//! Returns true if the three given points are collinear.
|
||||
/// @see gtx_vector_query extensions
|
||||
template<typename T, precision P = defaultp>
|
||||
GLM_FUNC_DECL bool areCollinear(tvec2<T, P> const& a, tvec2<T, P> const& b, tvec2<T, P> const& c);
|
||||
|
||||
//! Check whether two vectors are orthogonals.
|
||||
/// @see gtx_vector_query extensions.
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
|
|
|
@ -119,6 +119,17 @@ namespace detail
|
|||
return detail::compute_areCollinear<T, P, vecType>::call(v0, v1, epsilon);
|
||||
}
|
||||
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool areCollinear
|
||||
(
|
||||
tvec2<T, P> const& a,
|
||||
tvec2<T, P> const& b,
|
||||
tvec2<T, P> const& c
|
||||
)
|
||||
{
|
||||
return epsilonEqual(detail::area2(a, b, c), 0.0f, epsilon<float>());
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER bool areOrthogonal
|
||||
(
|
||||
|
|
Loading…
Add table
Reference in a new issue