Browse Source

Math: improve Constants docs, show useful identities.

pull/268/merge
Vladimír Vondruš 8 years ago
parent
commit
9f7512bf2b
  1. 2
      doc/changelog.dox
  2. 47
      src/Magnum/Math/Constants.h

2
doc/changelog.dox

@ -411,6 +411,8 @@ See also:
and caveats and caveats
- Reworked documentation of @ref Math::Algorithms, adding math equations and - Reworked documentation of @ref Math::Algorithms, adding math equations and
usage examples to all functions usage examples to all functions
- Improved documentation of @ref Math::Constants, showing useful identities
for each
- Explicitly mentioning copy/move constructibility for all classes with - Explicitly mentioning copy/move constructibility for all classes with
non-trivial construction non-trivial construction
- Improved Vcpkg build instructions (see - Improved Vcpkg build instructions (see

47
src/Magnum/Math/Constants.h

@ -46,30 +46,43 @@ template<class T> struct Constants {
/* See TypeTraits for answer why these are functions and not constants. */ /* See TypeTraits for answer why these are functions and not constants. */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
/** /**
* @brief Pi * @brief @f$ \pi @f$.
* *
* @f[
* \pi = 180 \degree
* @f]
* @see @ref piHalf(), @ref piQuarter(), @ref tau(), @ref Deg, @ref Rad * @see @ref piHalf(), @ref piQuarter(), @ref tau(), @ref Deg, @ref Rad
*/ */
static constexpr T pi(); static constexpr T pi();
/** /**
* @brief Half of a pi * @brief Half of a @f$ \pi @f$
* *
* @f[
* \frac{\pi}{2} = 90 \degree
* @f]
* @see @ref pi(), @ref piQuarter(), @ref tau(), @ref Deg, @ref Rad * @see @ref pi(), @ref piQuarter(), @ref tau(), @ref Deg, @ref Rad
*/ */
static constexpr T piHalf(); static constexpr T piHalf();
/** /**
* @brief Quarter of a pi * @brief Quarter of a @f$ \pi @f$
* *
* @f[
* \frac{\pi}{4} = 45 \degree
* @f]
* @see @ref pi(), @ref piHalf(), @ref tau(), @ref Deg, @ref Rad * @see @ref pi(), @ref piHalf(), @ref tau(), @ref Deg, @ref Rad
*/ */
static constexpr T piQuarter(); static constexpr T piQuarter();
/** /**
* @brief Tau * @brief @f$ \tau @f$.
* *
* Or two pi. See the [Tau manifesto](https://www.tauday.com/tau-manifesto). * Or two pi. See the [Tau manifesto](https://www.tauday.com/tau-manifesto).
*
* @f[
* \tau = 2 \pi = 360 \degree
* @f]
* @see @ref pi(), @ref piHalf(), @ref piQuarter(), @ref Deg, @ref Rad * @see @ref pi(), @ref piHalf(), @ref piQuarter(), @ref Deg, @ref Rad
*/ */
static constexpr T tau(); static constexpr T tau();
@ -77,12 +90,32 @@ template<class T> struct Constants {
/** /**
* @brief Euler's number * @brief Euler's number
* *
* @f[
* e = \ln (1)
* @f]
* @see @ref log(), @ref exp() * @see @ref log(), @ref exp()
*/ */
static constexpr T e(); static constexpr T e();
static constexpr T sqrt2(); /**< @brief Square root of 2 */ /**
static constexpr T sqrt3(); /**< @brief Square root of 3 */ * @brief Square root of 2
*
* @f[
* \sqrt{2}
* @f]
* @see @ref sqrt3(), @ref sqrtHalf()
*/
static constexpr T sqrt2();
/**
* @brief Square root of 3
*
* @f[
* \sqrt{3}
* @f]
* @see @ref sqrt2(), @ref sqrtHalf()
*/
static constexpr T sqrt3();
/** /**
* @brief Quiet NaN * @brief Quiet NaN
@ -92,7 +125,7 @@ template<class T> struct Constants {
static constexpr T nan(); static constexpr T nan();
/** /**
* @brief Positive infinity * @brief Positive @f$ \infty @f$.
* *
* @see @ref isInf() * @see @ref isInf()
*/ */

Loading…
Cancel
Save