mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-08 15:19:50 +00:00
Add glm 0.9.2
This commit is contained in:
parent
21545e1a24
commit
c4b531ed5e
218 changed files with 46187 additions and 0 deletions
58
ExternalLibs/glm/gtx/vector_angle.inl
Normal file
58
ExternalLibs/glm/gtx/vector_angle.inl
Normal file
|
@ -0,0 +1,58 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2005-12-30
|
||||
// Updated : 2008-09-29
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtx/vector_angle.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace gtx{
|
||||
namespace vector_angle{
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER typename genType::value_type angle
|
||||
(
|
||||
genType const & x,
|
||||
genType const & y
|
||||
)
|
||||
{
|
||||
return degrees(acos(dot(x, y)));
|
||||
}
|
||||
|
||||
//! \todo epsilon is hard coded to 0.01
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType orientedAngle
|
||||
(
|
||||
detail::tvec2<valType> const & x,
|
||||
detail::tvec2<valType> const & y
|
||||
)
|
||||
{
|
||||
valType Angle = glm::degrees(acos(dot(x, y)));
|
||||
detail::tvec2<valType> TransformedVector = glm::gtx::rotate_vector::rotate(x, Angle);
|
||||
if(all(equalEpsilon(y, TransformedVector, valType(0.01))))
|
||||
return Angle;
|
||||
else
|
||||
return -Angle;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER valType orientedAngle
|
||||
(
|
||||
detail::tvec3<valType> const & x,
|
||||
detail::tvec3<valType> const & y,
|
||||
detail::tvec3<valType> const & ref
|
||||
)
|
||||
{
|
||||
valType Angle = glm::degrees(glm::acos(glm::dot(x, y)));
|
||||
|
||||
if(glm::dot(ref, glm::cross(x, y)) < valType(0))
|
||||
return -Angle;
|
||||
else
|
||||
return Angle;
|
||||
}
|
||||
|
||||
}//namespace vector_angle
|
||||
}//namespace gtx
|
||||
}//namespace glm
|
Loading…
Add table
Add a link
Reference in a new issue