More constants related to pi

This commit is contained in:
Mathias Labeyrie 2014-11-05 10:58:56 +01:00
parent 041276c93d
commit b0c1777b57
2 changed files with 44 additions and 0 deletions

View File

@ -71,6 +71,11 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType pi(); GLM_FUNC_DECL genType pi();
/// Return pi * 2.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType two_pi();
/// Return square root of pi. /// Return square root of pi.
/// @see gtc_constants /// @see gtc_constants
template <typename genType> template <typename genType>
@ -81,6 +86,11 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType half_pi(); GLM_FUNC_DECL genType half_pi();
/// Return pi / 2 * 3.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType three_half_pi();
/// Return pi / 4. /// Return pi / 4.
/// @see gtc_constants /// @see gtc_constants
template <typename genType> template <typename genType>
@ -91,11 +101,21 @@ namespace glm
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType one_over_pi(); GLM_FUNC_DECL genType one_over_pi();
/// Return 1 / (pi * 2).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType one_over_two_pi();
/// Return 2 / pi. /// Return 2 / pi.
/// @see gtc_constants /// @see gtc_constants
template <typename genType> template <typename genType>
GLM_FUNC_DECL genType two_over_pi(); GLM_FUNC_DECL genType two_over_pi();
/// Return 4 / pi.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType four_over_pi();
/// Return 2 / sqrt(pi). /// Return 2 / sqrt(pi).
/// @see gtc_constants /// @see gtc_constants
template <typename genType> template <typename genType>

View File

@ -54,6 +54,12 @@ namespace glm
return genType(3.14159265358979323846264338327950288); return genType(3.14159265358979323846264338327950288);
} }
template <typename genType>
GLM_FUNC_QUALIFIER genType two_pi()
{
return genType(6.28318530717958647692528676655900576);
}
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType root_pi() GLM_FUNC_QUALIFIER genType root_pi()
{ {
@ -66,6 +72,12 @@ namespace glm
return genType(1.57079632679489661923132169163975144); return genType(1.57079632679489661923132169163975144);
} }
template <typename genType>
GLM_FUNC_QUALIFIER genType three_half_pi()
{
return genType(4.71238898038468985769396507491925432);
}
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType quarter_pi() GLM_FUNC_QUALIFIER genType quarter_pi()
{ {
@ -78,12 +90,24 @@ namespace glm
return genType(0.318309886183790671537767526745028724); return genType(0.318309886183790671537767526745028724);
} }
template <typename genType>
GLM_FUNC_QUALIFIER genType one_over_two_pi()
{
return genType(0.159154943091895335768883763372514362);
}
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType two_over_pi() GLM_FUNC_QUALIFIER genType two_over_pi()
{ {
return genType(0.636619772367581343075535053490057448); return genType(0.636619772367581343075535053490057448);
} }
template <typename genType>
GLM_FUNC_QUALIFIER genType four_over_pi()
{
return genType(1.273239544735162686151070106980114898);
}
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType two_over_root_pi() GLM_FUNC_QUALIFIER genType two_over_root_pi()
{ {