glm/glm/gtx/normalize_dot.inl

121 lines
2.5 KiB
Plaintext
Raw Normal View History

2010-04-29 10:54:07 +00:00
//////////////////////////////////////////////////////////////////////////////////
2011-01-20 11:40:14 +00:00
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
2010-04-29 10:54:07 +00:00
//////////////////////////////////////////////////////////////////////////////////
// Created : 2007-09-28
// Updated : 2008-10-07
// Licence : This source is under MIT License
// File : glm/gtx/normalize_dot.inl
//////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace gtx{
namespace normalize_dot{
template <typename genType>
2011-04-09 08:44:32 +00:00
GLM_FUNC_QUALIFIER genType normalizeDot
2010-04-29 10:54:07 +00:00
(
genType const & x,
genType const & y
)
{
return
glm::dot(x, y) *
glm::inversesqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename valType>
2011-04-09 08:44:32 +00:00
GLM_FUNC_QUALIFIER valType normalizeDot
2010-04-29 10:54:07 +00:00
(
detail::tvec2<valType> const & x,
detail::tvec2<valType> const & y
)
{
return
glm::dot(x, y) *
glm::inversesqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename valType>
2011-04-09 08:44:32 +00:00
GLM_FUNC_QUALIFIER valType normalizeDot
2010-04-29 10:54:07 +00:00
(
detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y
)
{
return
glm::dot(x, y) *
glm::inversesqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename valType>
2011-04-09 08:44:32 +00:00
GLM_FUNC_QUALIFIER valType normalizeDot
2010-04-29 10:54:07 +00:00
(
detail::tvec4<valType> const & x,
detail::tvec4<valType> const & y
)
{
return
glm::dot(x, y) *
glm::inversesqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename genType>
2011-04-09 08:44:32 +00:00
GLM_FUNC_QUALIFIER genType fastNormalizeDot
2010-04-29 10:54:07 +00:00
(
genType const & x,
genType const & y
)
{
return
glm::dot(x, y) *
glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename valType>
2011-04-09 08:44:32 +00:00
GLM_FUNC_QUALIFIER valType fastNormalizeDot
2010-04-29 10:54:07 +00:00
(
detail::tvec2<valType> const & x,
detail::tvec2<valType> const & y
)
{
return
glm::dot(x, y) *
glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename valType>
2011-04-09 08:44:32 +00:00
GLM_FUNC_QUALIFIER valType fastNormalizeDot
2010-04-29 10:54:07 +00:00
(
detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y
)
{
return
glm::dot(x, y) *
glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y));
}
template <typename valType>
2011-04-09 08:44:32 +00:00
GLM_FUNC_QUALIFIER valType fastNormalizeDot
2010-04-29 10:54:07 +00:00
(
detail::tvec4<valType> const & x,
detail::tvec4<valType> const & y
)
{
return
glm::dot(x, y) *
glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y));
}
}//namespace normalize_dot
}//namespace gtx
}//namespace glm