Added GLM_EXT_scalar_reciprocal and GLM_EXT_vector_reciprocal with tests
This commit is contained in:
@@ -111,6 +111,7 @@
|
||||
#include "./ext/scalar_constants.hpp"
|
||||
#include "./ext/scalar_integer.hpp"
|
||||
#include "./ext/scalar_packing.hpp"
|
||||
#include "./ext/scalar_reciprocal.hpp"
|
||||
#include "./ext/scalar_relational.hpp"
|
||||
#include "./ext/scalar_ulp.hpp"
|
||||
|
||||
@@ -120,6 +121,7 @@
|
||||
#include "./ext/vector_common.hpp"
|
||||
#include "./ext/vector_integer.hpp"
|
||||
#include "./ext/vector_packing.hpp"
|
||||
#include "./ext/vector_reciprocal.hpp"
|
||||
#include "./ext/vector_relational.hpp"
|
||||
#include "./ext/vector_ulp.hpp"
|
||||
|
||||
|
||||
135
glm/ext/scalar_reciprocal.hpp
Normal file
135
glm/ext/scalar_reciprocal.hpp
Normal file
@@ -0,0 +1,135 @@
|
||||
/// @ref ext_scalar_reciprocal
|
||||
/// @file glm/ext/scalar_reciprocal.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup ext_scalar_reciprocal GLM_EXT_scalar_reciprocal
|
||||
/// @ingroup ext
|
||||
///
|
||||
/// Include <glm/ext/scalar_reciprocal.hpp> to use the features of this extension.
|
||||
///
|
||||
/// Define secant, cosecant and cotangent functions.
|
||||
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
|
||||
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
|
||||
# pragma message("GLM: GLM_EXT_scalar_reciprocal extension included")
|
||||
#endif
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup ext_scalar_reciprocal
|
||||
/// @{
|
||||
|
||||
/// Secant function.
|
||||
/// hypotenuse / adjacent or 1 / cos(x)
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType sec(genType angle);
|
||||
|
||||
/// Cosecant function.
|
||||
/// hypotenuse / opposite or 1 / sin(x)
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType csc(genType angle);
|
||||
|
||||
/// Cotangent function.
|
||||
/// adjacent / opposite or 1 / tan(x)
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType cot(genType angle);
|
||||
|
||||
/// Inverse secant function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType asec(genType x);
|
||||
|
||||
/// Inverse cosecant function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acsc(genType x);
|
||||
|
||||
/// Inverse cotangent function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acot(genType x);
|
||||
|
||||
/// Secant hyperbolic function.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType sech(genType angle);
|
||||
|
||||
/// Cosecant hyperbolic function.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType csch(genType angle);
|
||||
|
||||
/// Cotangent hyperbolic function.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType coth(genType angle);
|
||||
|
||||
/// Inverse secant hyperbolic function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType asech(genType x);
|
||||
|
||||
/// Inverse cosecant hyperbolic function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acsch(genType x);
|
||||
|
||||
/// Inverse cotangent hyperbolic function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_scalar_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acoth(genType x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "scalar_reciprocal.inl"
|
||||
107
glm/ext/scalar_reciprocal.inl
Normal file
107
glm/ext/scalar_reciprocal.inl
Normal file
@@ -0,0 +1,107 @@
|
||||
/// @ref ext_scalar_reciprocal
|
||||
|
||||
#include "../trigonometric.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm
|
||||
{
|
||||
// sec
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sec(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sec' only accept floating-point values");
|
||||
return genType(1) / glm::cos(angle);
|
||||
}
|
||||
|
||||
// csc
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType csc(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csc' only accept floating-point values");
|
||||
return genType(1) / glm::sin(angle);
|
||||
}
|
||||
|
||||
// cot
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType cot(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cot' only accept floating-point values");
|
||||
|
||||
genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0);
|
||||
return glm::tan(pi_over_2 - angle);
|
||||
}
|
||||
|
||||
// asec
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asec(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asec' only accept floating-point values");
|
||||
return acos(genType(1) / x);
|
||||
}
|
||||
|
||||
// acsc
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acsc(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsc' only accept floating-point values");
|
||||
return asin(genType(1) / x);
|
||||
}
|
||||
|
||||
// acot
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acot(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acot' only accept floating-point values");
|
||||
|
||||
genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0);
|
||||
return pi_over_2 - atan(x);
|
||||
}
|
||||
|
||||
// sech
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sech(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sech' only accept floating-point values");
|
||||
return genType(1) / glm::cosh(angle);
|
||||
}
|
||||
|
||||
// csch
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType csch(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csch' only accept floating-point values");
|
||||
return genType(1) / glm::sinh(angle);
|
||||
}
|
||||
|
||||
// coth
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType coth(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'coth' only accept floating-point values");
|
||||
return glm::cosh(angle) / glm::sinh(angle);
|
||||
}
|
||||
|
||||
// asech
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asech(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asech' only accept floating-point values");
|
||||
return acosh(genType(1) / x);
|
||||
}
|
||||
|
||||
// acsch
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acsch(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsch' only accept floating-point values");
|
||||
return asinh(genType(1) / x);
|
||||
}
|
||||
|
||||
// acoth
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acoth(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acoth' only accept floating-point values");
|
||||
return atanh(genType(1) / x);
|
||||
}
|
||||
}//namespace glm
|
||||
135
glm/ext/vector_reciprocal.hpp
Normal file
135
glm/ext/vector_reciprocal.hpp
Normal file
@@ -0,0 +1,135 @@
|
||||
/// @ref ext_vector_reciprocal
|
||||
/// @file glm/ext/vector_reciprocal.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup gtc_reciprocal GLM_EXT_vector_reciprocal
|
||||
/// @ingroup ext
|
||||
///
|
||||
/// Include <glm/ext/vector_reciprocal.hpp> to use the features of this extension.
|
||||
///
|
||||
/// Define secant, cosecant and cotangent functions.
|
||||
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
|
||||
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
|
||||
# pragma message("GLM: GLM_EXT_vector_reciprocal extension included")
|
||||
#endif
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup ext_vector_reciprocal
|
||||
/// @{
|
||||
|
||||
/// Secant function.
|
||||
/// hypotenuse / adjacent or 1 / cos(x)
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType sec(genType angle);
|
||||
|
||||
/// Cosecant function.
|
||||
/// hypotenuse / opposite or 1 / sin(x)
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType csc(genType angle);
|
||||
|
||||
/// Cotangent function.
|
||||
/// adjacent / opposite or 1 / tan(x)
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType cot(genType angle);
|
||||
|
||||
/// Inverse secant function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType asec(genType x);
|
||||
|
||||
/// Inverse cosecant function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acsc(genType x);
|
||||
|
||||
/// Inverse cotangent function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acot(genType x);
|
||||
|
||||
/// Secant hyperbolic function.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType sech(genType angle);
|
||||
|
||||
/// Cosecant hyperbolic function.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType csch(genType angle);
|
||||
|
||||
/// Cotangent hyperbolic function.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType coth(genType angle);
|
||||
|
||||
/// Inverse secant hyperbolic function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType asech(genType x);
|
||||
|
||||
/// Inverse cosecant hyperbolic function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acsch(genType x);
|
||||
|
||||
/// Inverse cotangent hyperbolic function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see ext_vector_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acoth(genType x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "vector_reciprocal.inl"
|
||||
105
glm/ext/vector_reciprocal.inl
Normal file
105
glm/ext/vector_reciprocal.inl
Normal file
@@ -0,0 +1,105 @@
|
||||
/// @ref ext_vector_reciprocal
|
||||
|
||||
#include "../trigonometric.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm
|
||||
{
|
||||
// sec
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> sec(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs");
|
||||
return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(cos, x);
|
||||
}
|
||||
|
||||
// csc
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> csc(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs");
|
||||
return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(sin, x);
|
||||
}
|
||||
|
||||
// cot
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> cot(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs");
|
||||
T const pi_over_2 = static_cast<T>(3.1415926535897932384626433832795 / 2.0);
|
||||
return detail::functor1<vec, L, T, T, Q>::call(tan, pi_over_2 - x);
|
||||
}
|
||||
|
||||
// asec
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> asec(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(acos, static_cast<T>(1) / x);
|
||||
}
|
||||
|
||||
// acsc
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acsc(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(asin, static_cast<T>(1) / x);
|
||||
}
|
||||
|
||||
// acot
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acot(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs");
|
||||
T const pi_over_2 = static_cast<T>(3.1415926535897932384626433832795 / 2.0);
|
||||
return pi_over_2 - detail::functor1<vec, L, T, T, Q>::call(atan, x);
|
||||
}
|
||||
|
||||
// sech
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> sech(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs");
|
||||
return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(cosh, x);
|
||||
}
|
||||
|
||||
// csch
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> csch(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs");
|
||||
return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(sinh, x);
|
||||
}
|
||||
|
||||
// coth
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> coth(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs");
|
||||
return glm::cosh(x) / glm::sinh(x);
|
||||
}
|
||||
|
||||
// asech
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> asech(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(acosh, static_cast<T>(1) / x);
|
||||
}
|
||||
|
||||
// acsch
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acsch(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(asinh, static_cast<T>(1) / x);
|
||||
}
|
||||
|
||||
// acoth
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acoth(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(atanh, static_cast<T>(1) / x);
|
||||
}
|
||||
}//namespace glm
|
||||
@@ -19,117 +19,6 @@
|
||||
# pragma message("GLM: GLM_GTC_reciprocal extension included")
|
||||
#endif
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup gtc_reciprocal
|
||||
/// @{
|
||||
#include "../ext/scalar_reciprocal.hpp"
|
||||
#include "../ext/vector_reciprocal.hpp"
|
||||
|
||||
/// Secant function.
|
||||
/// hypotenuse / adjacent or 1 / cos(x)
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType sec(genType angle);
|
||||
|
||||
/// Cosecant function.
|
||||
/// hypotenuse / opposite or 1 / sin(x)
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType csc(genType angle);
|
||||
|
||||
/// Cotangent function.
|
||||
/// adjacent / opposite or 1 / tan(x)
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType cot(genType angle);
|
||||
|
||||
/// Inverse secant function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType asec(genType x);
|
||||
|
||||
/// Inverse cosecant function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acsc(genType x);
|
||||
|
||||
/// Inverse cotangent function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acot(genType x);
|
||||
|
||||
/// Secant hyperbolic function.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType sech(genType angle);
|
||||
|
||||
/// Cosecant hyperbolic function.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType csch(genType angle);
|
||||
|
||||
/// Cotangent hyperbolic function.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType coth(genType angle);
|
||||
|
||||
/// Inverse secant hyperbolic function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType asech(genType x);
|
||||
|
||||
/// Inverse cosecant hyperbolic function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acsch(genType x);
|
||||
|
||||
/// Inverse cotangent hyperbolic function.
|
||||
///
|
||||
/// @return Return an angle expressed in radians.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acoth(genType x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "reciprocal.inl"
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
/// @ref gtc_reciprocal
|
||||
|
||||
#include "../trigonometric.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm
|
||||
{
|
||||
// sec
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sec(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sec' only accept floating-point values");
|
||||
return genType(1) / glm::cos(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> sec(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(sec, x);
|
||||
}
|
||||
|
||||
// csc
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType csc(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csc' only accept floating-point values");
|
||||
return genType(1) / glm::sin(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> csc(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(csc, x);
|
||||
}
|
||||
|
||||
// cot
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType cot(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cot' only accept floating-point values");
|
||||
|
||||
genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0);
|
||||
return glm::tan(pi_over_2 - angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> cot(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(cot, x);
|
||||
}
|
||||
|
||||
// asec
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asec(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asec' only accept floating-point values");
|
||||
return acos(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> asec(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(asec, x);
|
||||
}
|
||||
|
||||
// acsc
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acsc(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsc' only accept floating-point values");
|
||||
return asin(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acsc(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(acsc, x);
|
||||
}
|
||||
|
||||
// acot
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acot(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acot' only accept floating-point values");
|
||||
|
||||
genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0);
|
||||
return pi_over_2 - atan(x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acot(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(acot, x);
|
||||
}
|
||||
|
||||
// sech
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sech(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sech' only accept floating-point values");
|
||||
return genType(1) / glm::cosh(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> sech(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(sech, x);
|
||||
}
|
||||
|
||||
// csch
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType csch(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csch' only accept floating-point values");
|
||||
return genType(1) / glm::sinh(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> csch(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(csch, x);
|
||||
}
|
||||
|
||||
// coth
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType coth(genType angle)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'coth' only accept floating-point values");
|
||||
return glm::cosh(angle) / glm::sinh(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> coth(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(coth, x);
|
||||
}
|
||||
|
||||
// asech
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asech(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asech' only accept floating-point values");
|
||||
return acosh(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> asech(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(asech, x);
|
||||
}
|
||||
|
||||
// acsch
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acsch(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsch' only accept floating-point values");
|
||||
return asinh(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acsch(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(acsch, x);
|
||||
}
|
||||
|
||||
// acoth
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acoth(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acoth' only accept floating-point values");
|
||||
return atanh(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acoth(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs");
|
||||
return detail::functor1<vec, L, T, T, Q>::call(acoth, x);
|
||||
}
|
||||
}//namespace glm
|
||||
Reference in New Issue
Block a user