Updated constants list

This commit is contained in:
Christophe Riccio 2011-12-07 12:37:22 +00:00
parent 59b0d3ae00
commit a3b5034d4e
2 changed files with 59 additions and 4 deletions

View File

@ -58,6 +58,16 @@ namespace glm
template <typename T> template <typename T>
T epsilon(); T epsilon();
/// Return 0.
/// @see gtx_constants
template <typename T>
T zero();
/// Return 1.
/// @see gtx_constants
template <typename T>
T one();
/// Return the pi constant. /// Return the pi constant.
/// @see gtx_constants /// @see gtx_constants
template <typename T> template <typename T>
@ -128,6 +138,16 @@ namespace glm
template <typename T> template <typename T>
T root_two(); T root_two();
/// Return sqrt(3).
/// @see gtx_constants
template <typename T>
T root_three();
/// Return sqrt(5).
/// @see gtx_constants
template <typename T>
T root_five();
/// Return ln(2). /// Return ln(2).
/// @see gtx_constants /// @see gtx_constants
template <typename T> template <typename T>
@ -151,7 +171,12 @@ namespace glm
/// Return 2 / 3. /// Return 2 / 3.
/// @see gtx_constants /// @see gtx_constants
template <typename T> template <typename T>
T twothirds(); T two_thirds();
/// Return the golden ratio constant.
/// @see gtx_constants
template <typename T>
T golden_ratio();
/// @} /// @}
} //namespace glm } //namespace glm

View File

@ -34,6 +34,18 @@ namespace glm
return std::numeric_limits<T>::epsilon(); return std::numeric_limits<T>::epsilon();
} }
template <typename T>
GLM_FUNC_QUALIFIER T zero()
{
return T(0);
}
template <typename T>
GLM_FUNC_QUALIFIER T one()
{
return T(1);
}
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T pi() GLM_FUNC_QUALIFIER T pi()
{ {
@ -118,6 +130,18 @@ namespace glm
return T(1.41421356237309504880168872420969808); return T(1.41421356237309504880168872420969808);
} }
template <typename T>
GLM_FUNC_QUALIFIER T root_three()
{
return T(1.73205080756887729352744634150587236);
}
template <typename T>
GLM_FUNC_QUALIFIER T root_five()
{
return T(2.23606797749978969640917366873127623);
}
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T ln_two() GLM_FUNC_QUALIFIER T ln_two()
{ {
@ -139,12 +163,18 @@ namespace glm
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T third() GLM_FUNC_QUALIFIER T third()
{ {
return T(0.333333333333333333); return T(0.3333333333333333333333333333333333333333);
} }
template <typename T> template <typename T>
GLM_FUNC_QUALIFIER T twothirds() GLM_FUNC_QUALIFIER T two_thirds()
{ {
return T(0.666666666666666667); return T(0.666666666666666666666666666666666666667);
}
template <typename T>
GLM_FUNC_QUALIFIER T golden_ratio()
{
return T(1.61803398874989484820458683436563811);
} }
} //namespace glm } //namespace glm