From 05bb8b419a6b4c35048485c1cd06103f33559a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 21 Dec 2017 15:02:06 +0100 Subject: [PATCH] Math: updates for the new documentation theme. --- src/Magnum/Math/Algorithms/GaussJordan.h | 8 +- src/Magnum/Math/Algorithms/KahanSum.h | 6 +- src/Magnum/Math/Algorithms/Svd.h | 17 +-- src/Magnum/Math/Angle.h | 51 +++++---- src/Magnum/Math/Bezier.h | 24 ++-- src/Magnum/Math/BoolVector.h | 8 +- src/Magnum/Math/Color.h | 139 +++++++++++++---------- src/Magnum/Math/Dual.h | 3 +- src/Magnum/Math/DualComplex.h | 14 +-- src/Magnum/Math/Functions.h | 15 ++- src/Magnum/Math/Half.h | 6 +- src/Magnum/Math/Matrix.h | 3 +- src/Magnum/Math/Matrix3.h | 4 +- src/Magnum/Math/Matrix4.h | 12 +- src/Magnum/Math/Packing.h | 27 +++-- src/Magnum/Math/Range.h | 5 +- src/Magnum/Math/RectangularMatrix.h | 18 +-- src/Magnum/Math/Swizzle.h | 15 ++- src/Magnum/Math/TypeTraits.h | 3 +- src/Magnum/Math/Vector.h | 13 ++- src/Magnum/Math/Vector2.h | 8 +- src/Magnum/Math/Vector3.h | 8 +- 22 files changed, 235 insertions(+), 172 deletions(-) diff --git a/src/Magnum/Math/Algorithms/GaussJordan.h b/src/Magnum/Math/Algorithms/GaussJordan.h index 42efb6bb9..8ba90a330 100644 --- a/src/Magnum/Math/Algorithms/GaussJordan.h +++ b/src/Magnum/Math/Algorithms/GaussJordan.h @@ -50,7 +50,7 @@ reasons, only pure Gaussian elimination is done on @p a and the final backsubstitution is done only on @p t, as @p a would always end with identity matrix anyway. -Based on ultra-compact Python code by Jarno Elonen, +Based on an ultra-compact Python code by Jarno Elonen, http://elonen.iki.fi/code/misc-notes/python-gaussj/index.html. */ template bool gaussJordanInPlaceTransposed(RectangularMatrix& a, RectangularMatrix& t) { @@ -114,9 +114,9 @@ template bool gaussJordanInPlace(Re /** @brief Gauss-Jordan matrix inversion -Since @f$ (\boldsymbol{A}^{-1})^T = (\boldsymbol{A}^T)^{-1} @f$, passes @p a -and an identity matrix to @ref gaussJordanInPlaceTransposed() and returns the -inverted matrix. Expects that the matrix is invertible. +Since @f$ (\boldsymbol{A}^{-1})^T = (\boldsymbol{A}^T)^{-1} @f$, passes +@p matrix and an identity matrix to @ref gaussJordanInPlaceTransposed(); +returning the inverted matrix. Expects that the matrix is invertible. @see @ref Matrix::inverted() */ template Matrix gaussJordanInverted(Matrix matrix) { diff --git a/src/Magnum/Math/Algorithms/KahanSum.h b/src/Magnum/Math/Algorithms/KahanSum.h index eaae27a3c..ec93c5fa9 100644 --- a/src/Magnum/Math/Algorithms/KahanSum.h +++ b/src/Magnum/Math/Algorithms/KahanSum.h @@ -48,7 +48,8 @@ significantly reduces numerical error in the total. See Wikipedia for an in-depth explanation: https://en.wikipedia.org/wiki/Kahan_summation_algorithm Example with summation of a hundred million ones: -@code + +@code{.cpp} std::vector data(100000000, 1.0f); Float a = std::accumulate(data.begin(), data.end()); // 1.667e7f Float b = Math::Algorithms::kahanSum(data.begin(), data.end()); // 1.000e8f @@ -58,7 +59,8 @@ If required, it is also possible to use this algorithm on non-contiguous ranges or single values (for example when calculating sum of pixel values in an image with some row padding or when the inputs are generated / converted from other values): -@code + +@code{.cpp} Containers::ArrayView pixels; Float sum = 0.0f, c = 0.0f; for(UnsignedByte pixel: pixels) { diff --git a/src/Magnum/Math/Algorithms/Svd.h b/src/Magnum/Math/Algorithms/Svd.h index 72c8e1d1e..5e242d1b0 100644 --- a/src/Magnum/Math/Algorithms/Svd.h +++ b/src/Magnum/Math/Algorithms/Svd.h @@ -68,23 +68,24 @@ zero matrices. Full @f$ U @f$, @f$ \Sigma @f$ matrices and original @f$ M @f$ matrix can be reconstructed from the values as following: -@code -RectangularMatrix m; -RectangularMatrix uPart; -Vector wDiagonal; -Matrix v; +@code{.cpp} +Math::RectangularMatrix m; + +Math::RectangularMatrix uPart; +Math::Vector wDiagonal; +Math::Matrix v; std::tie(uPart, wDiagonal, v) = Math::Algorithms::svd(m); // Extend U -Matrix u(Matrix::Zero); +Math::Matrix u(Matrix::Zero); for(std::size_t i = 0; i != rows; ++i) u[i] = uPart[i]; // Diagonal W -RectangularMatrix w = - RectangularMatrix::fromDiagonal(wDiagonal); +Math::RectangularMatrix w = + Math::RectangularMatrix::fromDiagonal(wDiagonal); // u*w*v.transposed() == m @endcode diff --git a/src/Magnum/Math/Angle.h b/src/Magnum/Math/Angle.h index 9b28be605..5f208cb2b 100644 --- a/src/Magnum/Math/Angle.h +++ b/src/Magnum/Math/Angle.h @@ -42,22 +42,24 @@ namespace Magnum { namespace Math { /** @brief Angle in degrees -Along with Rad provides convenience classes to make angle specification and -conversion less error-prone. +Along with @ref Rad provides convenience classes to make angle specification +and conversion less error-prone. -## Usage +@section Math-Deg-usage Usage -You can enter the value either by using literal: -@code +You can enter the value either by using a literal: + +@code{.cpp} using namespace Literals; auto degrees = 60.0_degf; // type is Deg auto radians = 1.047_rad; // type is Rad @endcode -Or explicitly convert unitless value (such as output from some function) to +Or explicitly convert a unitless value (such as output from some function) to either degrees or radians: -@code + +@code{.cpp} Double foo(); Deg degrees(35.0f); @@ -66,8 +68,9 @@ Rad radians(foo()); @endcode The classes support all arithmetic operations, such as addition, subtraction -or multiplication/division by unitless number: -@code +or multiplication/division by a unitless number: + +@code{.cpp} auto a = 60.0_degf + 17.35_degf; auto b = -a + 23.0_degf*4; //auto c = 60.0_degf*45.0_degf; // error, undefined resulting unit @@ -76,7 +79,8 @@ auto b = -a + 23.0_degf*4; It is also possible to compare angles with all comparison operators, but comparison of degrees and radians is not possible without explicit conversion to common type: -@code + +@code{.cpp} Rad angle(); Deg x = angle(); // convert to degrees for easier comparison @@ -85,8 +89,9 @@ if(x < 30.0_degf) foo(); @endcode It is possible to seamlessly convert between degrees and radians and explicitly -convert the value back to underlying type: -@code +convert the value back to the underlying type: + +@code{.cpp} Float sine(Rad angle); Float a = sine(60.0_degf); // the same as sine(1.047_radf) Deg b = 1.047_rad; // the same as 60.0_deg @@ -94,12 +99,13 @@ Float d = Double(b); // 60.0 //Float e = b; // error, no implicit conversion @endcode -## Requirement of explicit conversion +@section Math-Angle-explicit-conversion Requirement of explicit conversion The requirement of explicit conversions from and to unitless types helps to reduce unit-based errors. Consider following example with implicit conversions allowed: -@code + +@code{.cpp} namespace std { float sin(float angle); } Float sine(Rad angle); @@ -111,7 +117,8 @@ std::sin(b); // silent error, std::sin() expected radians @endcode These silent errors are easily avoided by requiring explicit conversions: -@code + +@code{.cpp} //sine(a); // compilation error sine(Deg{a}); // explicitly specifying unit @@ -153,8 +160,7 @@ template class Deg: public Unit { /** * @brief Construct degrees from radians * - * Performs conversion from radians to degrees, i.e.: - * @f[ + * Performs conversion from radians to degrees, i.e.: @f[ * deg = 180 \frac {rad} \pi * @f] */ @@ -167,10 +173,12 @@ namespace Literals { @brief Double-precision degree value literal Example usage: -@code + +@code{.cpp} Double cosine = Math::cos(60.0_deg); // cosine = 0.5 Double cosine = Math::cos(1.047_rad); // cosine = 0.5 @endcode + @see @link operator""_degf() @endlink, @link operator""_rad() @endlink */ constexpr Deg operator "" _deg(long double value) { return Deg(Double(value)); } @@ -179,10 +187,12 @@ constexpr Deg operator "" _deg(long double value) { return Deg(D @brief Single-precision degree value literal Example usage: -@code + +@code{.cpp} Float tangent = Math::tan(60.0_degf); // tangent = 1.732f Float tangent = Math::tan(1.047_radf); // tangent = 1.732f @endcode + @see @link operator""_deg() @endlink, @link operator""_radf() @endlink */ constexpr Deg operator "" _degf(long double value) { return Deg(Float(value)); } @@ -225,8 +235,7 @@ template class Rad: public Unit { /** * @brief Construct radians from degrees * - * Performs conversion from degrees to radians, i.e.: - * @f[ + * Performs conversion from degrees to radians, i.e.: @f[ * rad = deg \frac \pi 180 * @f] */ diff --git a/src/Magnum/Math/Bezier.h b/src/Magnum/Math/Bezier.h index 4d3919021..890ab1506 100644 --- a/src/Magnum/Math/Bezier.h +++ b/src/Magnum/Math/Bezier.h @@ -182,8 +182,8 @@ template class Bezier { /** @brief Quadratic Bézier curve -Convenience alternative to `Bezier<2, dimensions, T>`. See @ref Bezier for more -information. +Convenience alternative to @cpp Bezier<2, dimensions, T> @ce. See @ref Bezier +for more information. @see @ref QuadraticBezier2D, @ref QuadraticBezier3D */ #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Multiple definitions still broken */ @@ -193,8 +193,8 @@ template using QuadraticBezier = Bezier<2, dime /** @brief Two-dimensional quadratic Bézier curve -Convenience alternative to `QuadraticBezier<2, T>`. See @ref QuadraticBezier -and @ref Bezier for more information. +Convenience alternative to @cpp QuadraticBezier<2, T> @ce. See +@ref QuadraticBezier and @ref Bezier for more information. @see @ref QuadraticBezier3D, @ref Magnum::QuadraticBezier2D, @ref Magnum::QuadraticBezier2Dd */ @@ -205,8 +205,8 @@ template using QuadraticBezier2D = QuadraticBezier<2, T>; /** @brief Three-dimensional quadratic Bézier curve -Convenience alternative to `QuadraticBezier<3, T>`. See @ref QuadraticBezier -and @ref Bezier for more information. +Convenience alternative to @cpp QuadraticBezier<3, T> @ce. See +@ref QuadraticBezier and @ref Bezier for more information. @see @ref QuadraticBezier2D, @ref Magnum::QuadraticBezier3D, @ref Magnum::QuadraticBezier3Dd */ @@ -217,8 +217,8 @@ template using QuadraticBezier3D = QuadraticBezier<3, T>; /** @brief Cubic Bézier curve -Convenience alternative to `Bezier<3, dimensions, T>`. See @ref Bezier for more -information. +Convenience alternative to @cpp Bezier<3, dimensions, T> @ce. See @ref Bezier +for more information. @see @ref CubicBezier2D, @ref CubicBezier3D */ #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Multiple definitions still broken */ @@ -228,8 +228,8 @@ template using CubicBezier = Bezier<3, dimensio /** @brief Two-dimensional cubic Bézier curve -Convenience alternative to `CubicBezier<2, T>`. See @ref CubicBezier -and @ref Bezier for more information. +Convenience alternative to @cpp CubicBezier<2, T> @ce. See @ref CubicBezier and +@ref Bezier for more information. @see @ref CubicBezier3D, @ref Magnum::CubicBezier2D, @ref Magnum::CubicBezier2Dd */ @@ -240,8 +240,8 @@ template using CubicBezier2D = CubicBezier<2, T>; /** @brief Three-dimensional cubic Bézier curve -Convenience alternative to `CubicBezier<3, T>`. See @ref CubicBezier -and @ref Bezier for more information. +Convenience alternative to @cpp CubicBezier<3, T> @ce. See @ref CubicBezier and +@ref Bezier for more information. @see @ref CubicBezier2D, @ref Magnum::CubicBezier3D, @ref Magnum::CubicBezier3Dd */ diff --git a/src/Magnum/Math/BoolVector.h b/src/Magnum/Math/BoolVector.h index 2b2bf4195..a36b7ef8d 100644 --- a/src/Magnum/Math/BoolVector.h +++ b/src/Magnum/Math/BoolVector.h @@ -58,10 +58,10 @@ namespace Implementation { @brief Vector storing boolean values @tparam size Bit count -Result of component-wise comparison from Vector. The boolean values are stored -as bits in array of unsigned bytes, unused bits have undefined value which -doesn't affect comparison or @ref all() / @ref none() / @ref any() functions. -See also @ref matrix-vector for brief introduction. +Result of component-wise comparison from @ref Vector. The boolean values are +stored as bits in array of unsigned bytes, unused bits have undefined value +which doesn't affect comparison or @ref all() / @ref none() / @ref any() +functions. See also @ref matrix-vector for brief introduction. */ template class BoolVector { static_assert(size != 0, "BoolVector cannot have zero elements"); diff --git a/src/Magnum/Math/Color.h b/src/Magnum/Math/Color.h index 663064452..d09199a6a 100644 --- a/src/Magnum/Math/Color.h +++ b/src/Magnum/Math/Color.h @@ -211,15 +211,16 @@ template constexpr typename std::enable_if::value, The class can store either floating-point (normalized) or integral (denormalized) representation of linear RGB color. Colors in sRGB color space -should not be used directly in calculations -- they should be converted to +should not be used directly in calculations --- they should be converted to linear RGB using @ref fromSrgb(), calculation done on the linear representation and then converted back to sRGB using @ref toSrgb(). Note that constructor conversion between different types (like in @ref Vector classes) doesn't do any (de)normalization, you should use @ref pack) and @ref unpack() instead, for example: -@code -Color3 a(1.0f, 0.5f, 0.75f); + +@code{.cpp} +Color3 a{1.0f, 0.5f, 0.75f}; auto b = pack(a); // b == {255, 127, 191} @endcode @@ -238,8 +239,8 @@ template class Color3: public Vector3 { /** * @brief Red color * - * Convenience alternative to e.g. `Color3(red, 0.0f, 0.0f)`. With - * floating-point underlying type equivalent to @ref Vector3::xAxis(). + * Convenience alternative to e.g. @cpp Color3{red, 0.0f, 0.0f} @ce. + * With floating-point underlying type equivalent to @ref Vector3::xAxis(). * @see @ref green(), @ref blue(), @ref cyan() */ constexpr static Color3 red(T red = Implementation::fullChannel()) { @@ -249,8 +250,8 @@ template class Color3: public Vector3 { /** * @brief Green color * - * Convenience alternative to e.g. `Color3(0.0f, green, 0.0f)`. With - * floating-point underlying type equivalent to @ref Vector3::yAxis(). + * Convenience alternative to e.g. @cpp Color3(0.0f, green, 0.0f) @ce. + * With floating-point underlying type equivalent to @ref Vector3::yAxis(). * @see @ref red(), @ref blue(), @ref magenta() */ constexpr static Color3 green(T green = Implementation::fullChannel()) { @@ -260,8 +261,8 @@ template class Color3: public Vector3 { /** * @brief Blue color * - * Convenience alternative to e.g. `Color3(0.0f, 0.0f, blue)`. With - * floating-point underlying type equivalent to @ref Vector3::zAxis(). + * Convenience alternative to e.g. @cpp Color3{0.0f, 0.0f, blue} @ce. + * With floating-point underlying type equivalent to @ref Vector3::zAxis(). * @see @ref red(), @ref green(), @ref yellow() */ constexpr static Color3 blue(T blue = Implementation::fullChannel()) { @@ -271,8 +272,8 @@ template class Color3: public Vector3 { /** * @brief Cyan color * - * Convenience alternative to e.g. `Color3(red, 1.0f, 1.0f)`. With - * floating-point underlying type equivalent to @ref Vector3::xScale(). + * Convenience alternative to e.g. @cpp Color3{red, 1.0f, 1.0f} @ce. + * With floating-point underlying type equivalent to @ref Vector3::xScale(). * @see @ref magenta(), @ref yellow(), @ref red() */ constexpr static Color3 cyan(T red = T(0)) { @@ -282,8 +283,8 @@ template class Color3: public Vector3 { /** * @brief Magenta color * - * Convenience alternative to e.g. `Color3(0.0f, green, 0.0f)`. With - * floating-point underlying type equivalent to @ref Vector3::yScale(). + * Convenience alternative to e.g. @cpp Color3{1.0f, green, 1.0f} @ce. + * With floating-point underlying type equivalent to @ref Vector3::yScale(). * @see @ref cyan(), @ref yellow(), @ref green() */ constexpr static Color3 magenta(T green = T(0)) { @@ -293,8 +294,8 @@ template class Color3: public Vector3 { /** * @brief Yellow color * - * Convenience alternative to `Color3(0.0f, 0.0f, yellow)`. With - * floating-point underlying type equivalent to @ref Vector3::zScale(). + * Convenience alternative to e.g. @cpp Color3{1.0f, 1.0f, yellow} @ce. + * With floating-point underlying type equivalent to @ref Vector3::zScale(). * @see @ref cyan(), @ref magenta(), @ref red() */ constexpr static Color3 yellow(T blue = T(0)) { @@ -311,8 +312,8 @@ template class Color3: public Vector3 { /** * @brief Type for storing HSV color space values * - * Hue in range @f$ [0.0, 360.0] @f$, saturation and value in - * range @f$ [0.0, 1.0] @f$. + * Hue in range @f$ [0.0, 360.0] @f$, saturation and value in range + * @f$ [0.0, 1.0] @f$. */ typedef std::tuple, FloatingPointType, FloatingPointType> Hsv; @@ -381,7 +382,8 @@ template class Color3: public Vector3 { * Useful in cases where you have for example an 8-bit sRGB * representation and want to create a floating-point linear RGB color * out of it: - * @code + * + * @code{.cpp} * Math::Vector3 srgb; * auto rgb = Color3::fromSrgb(srgb); * @endcode @@ -472,7 +474,8 @@ template class Color3: public Vector3 { * @brief Convert to HSV representation * * Example usage: - * @code + * + * @code{.cpp} * Deg hue; * Float saturation, value; * std::tie(hue, saturation, value) = color.toHsv(); @@ -543,7 +546,8 @@ template class Color3: public Vector3 { * * Useful in cases where you have a floating-point linear RGB color and * want to create for example an 8-bit sRGB representation out of it: - * @code + * + * @code{.cpp} * Color3 color; * Math::Vector3 srgb = color.toSrgb(); * @endcode @@ -616,7 +620,7 @@ class Color4: public Vector4 { /** * @brief Red color * - * Convenience alternative to e.g. `Color4(red, 0.0f, 0.0f, alpha)`. + * Convenience alternative to e.g. @cpp Color4{red, 0.0f, 0.0f, alpha} @ce. * @see @ref green(), @ref blue(), @ref cyan() */ constexpr static Color4 red(T red = Implementation::fullChannel(), T alpha = Implementation::fullChannel()) { @@ -626,7 +630,7 @@ class Color4: public Vector4 { /** * @brief Green color * - * Convenience alternative to e.g. `Color4(0.0f, green, 0.0f, alpha)`. + * Convenience alternative to e.g. @cpp Color4{0.0f, green, 0.0f, alpha} @ce. * @see @ref red(), @ref blue(), @ref magenta() */ constexpr static Color4 green(T green = Implementation::fullChannel(), T alpha = Implementation::fullChannel()) { @@ -636,7 +640,7 @@ class Color4: public Vector4 { /** * @brief Blue color * - * Convenience alternative to e.g. `Color4(0.0f, 0.0f, blue, alpha)`. + * Convenience alternative to e.g. @cpp Color4{0.0f, 0.0f, blue, alpha} @ce. * @see @ref red(), @ref green(), @ref yellow() */ constexpr static Color4 blue(T blue = Implementation::fullChannel(), T alpha = Implementation::fullChannel()) { @@ -646,7 +650,7 @@ class Color4: public Vector4 { /** * @brief Cyan color * - * Convenience alternative to e.g. `Color4(red, 1.0f, 1.0f, alpha)`. + * Convenience alternative to e.g. @cpp Color4{red, 1.0f, 1.0f, alpha} @ce. * @see @ref magenta(), @ref yellow(), @ref red() */ constexpr static Color4 cyan(T red = T(0), T alpha = Implementation::fullChannel()) { @@ -656,7 +660,7 @@ class Color4: public Vector4 { /** * @brief Magenta color * - * Convenience alternative to e.g. `Color4(1.0f, green, 1.0f, alpha)`. + * Convenience alternative to e.g. @cpp Color4{1.0f, green, 1.0f, alpha} @ce. * @see @ref cyan(), @ref yellow(), @ref green() */ constexpr static Color4 magenta(T green = T(0), T alpha = Implementation::fullChannel()) { @@ -666,7 +670,7 @@ class Color4: public Vector4 { /** * @brief Yellow color * - * Convenience alternative to e.g. `Color4(1.0f, 1.0f, blue, alpha)`. + * Convenience alternative to e.g. @cpp Color4{1.0f, 1.0f, blue, alpha} @ce. * @see @ref cyan(), @ref magenta(), @ref red() */ constexpr static Color4 yellow(T blue = T(0), T alpha = Implementation::fullChannel()) { @@ -676,8 +680,9 @@ class Color4: public Vector4 { /** * @brief Create RGB color from HSV representation * @param hsv Color in HSV color space - * @param a Alpha value, defaults to `1.0` for floating-point types - * and maximum positive value for integral types. + * @param a Alpha value, defaults to @cpp 1.0 @ce for + * floating-point types and maximum positive value for integral + * types * * Hue can overflow the range @f$ [0.0, 360.0] @f$. * @see @ref toHsv() @@ -724,8 +729,9 @@ class Color4: public Vector4 { /** * @brief Create linear RGBA color from sRGB representation * @param srgb Color in sRGB color space - * @param a Alpha value, defaults to `1.0` for floating-point - * types and maximum positive value for integral types. + * @param a Alpha value, defaults to @cpp 1.0 @ce for + * floating-point types and maximum positive value for integral + * types * * Applies inverse sRGB curve onto RGB channels of the input. Alpha * value is taken as-is. See @ref Color3::fromSrgb() for more @@ -745,7 +751,8 @@ class Color4: public Vector4 { * Useful in cases where you have for example an 8-bit sRGB + alpha * representation and want to create a floating-point linear RGBA color * out of it: - * @code + * + * @code{.cpp} * Math::Vector4 srgbAlpha; * auto rgba = Color4::fromSrgbAlpha(srgbAlpha); * @endcode @@ -759,13 +766,15 @@ class Color4: public Vector4 { /** @overload * @brief Create linear RGB color from integral sRGB representation * @param srgb Color in sRGB color space - * @param a Alpha value, defaults to `1.0` for floating-point - * types and maximum positive value for integral types. + * @param a Alpha value, defaults to @cpp 1.0 @ce for + * floating-point types and maximum positive value for integral + * types * * Useful in cases where you have for example an 8-bit sRGB * representation and want to create a floating-point linear RGBA color * out of it: - * @code + * + * @code{.cpp} * Math::Vector3 srgb; * auto rgba = Color4::fromSrgb(srgb); * @endcode @@ -779,8 +788,9 @@ class Color4: public Vector4 { /** * @brief Create RGBA color from CIE XYZ representation * @param xyz Color in CIE XYZ color space - * @param a Alpha value, defaults to `1.0` for floating-point types - * and maximum positive value for integral types. + * @param a Alpha value, defaults to @cpp 1.0 @ce for + * floating-point types and maximum positive value for integral + * types * * Applies transformation matrix, returning the input in linear RGB * color space. See @ref Color3::fromXyz() for more information. @@ -815,8 +825,9 @@ class Color4: public Vector4 { /** * @copydoc Color3::Color3(T) - * @param alpha Alpha value, defaults to `1.0` for floating-point types - * and maximum positive value for integral types. + * @param alpha Alpha value, defaults to @cpp 1.0 @ce for + * floating-point types and maximum positive value for integral + * types */ constexpr explicit Color4(T rgb, T alpha = Implementation::fullChannel()) noexcept: Vector4(rgb, rgb, rgb, alpha) {} @@ -825,8 +836,8 @@ class Color4: public Vector4 { * @param r R value * @param g G value * @param b B value - * @param a A value, defaults to `1.0` for floating-point types and - * maximum positive value for integral types. + * @param a A value, defaults to @cpp 1.0 @ce for floating-point + * types and maximum positive value for integral types. */ constexpr /*implicit*/ Color4(T r, T g, T b, T a = Implementation::fullChannel()) noexcept: Vector4(r, g, b, a) {} @@ -866,7 +877,8 @@ class Color4: public Vector4 { * * The alpha channel is not subject to any conversion, so it is * ignored. Example usage: - * @code + * + * @code{.cpp} * Deg hue; * Float saturation, value; * std::tie(hue, saturation, value) = color.toHsv(); @@ -920,7 +932,8 @@ class Color4: public Vector4 { * Useful in cases where you have a floating-point linear RGBA color * and want to create for example an 8-bit sRGB + alpha representation * out of it: - * @code + * + * @code{.cpp} * Color4 color; * Math::Vector4 srgbAlpha = color.toSrgbAlpha(); * @endcode @@ -998,7 +1011,8 @@ namespace Literals { @brief 8bit-per-channel linear RGB literal Unpacks the literal into three 8-bit values. Example usage: -@code + +@code{.cpp} Color3ub a = 0x33b27f_rgb; // {0x33, 0xb2, 0x7f} @endcode @@ -1020,13 +1034,14 @@ Unpacks the literal into three 8-bit values without any colorspace conversion. Behaves identically to @link operator""_rgb() @endlink though it doesn't return a @ref Color3 type to indicate that the resulting value is not linear RGB. Use this literal to document that given value is in sRGB. Example usage: -@code + +@code{.cpp} Math::Vector3 a = 0x33b27f_srgb; // {0x33, 0xb2, 0x7f} @endcode @attention Note that colors in sRGB representation should not be used directly - in calculations -- they should be converted to linear RGB, calculation done - on the linear representation and then converted back to sRGB. Use the + in calculations --- they should be converted to linear RGB, calculation + done on the linear representation and then converted back to sRGB. Use the @link operator""_srgbf() @endlink literal if you want to get a linear RGB representation directly or convert the value using @ref Color3::fromSrgb(). @@ -1042,7 +1057,8 @@ constexpr Vector3 operator "" _srgb(unsigned long long value) { @brief 8bit-per-channel linear RGBA literal Unpacks the literal into four 8-bit values. Example usage: -@code + +@code{.cpp} Color4ub a = 0x33b27fcc_rgba; // {0x33, 0xb2, 0x7f, 0xcc} @endcode @@ -1065,13 +1081,14 @@ Behaves identically to @link operator""_rgba() @endlink though it doesn't return a @ref Color4 type to indicate that the resulting value is not linear RGBA. Use this literal to document that given value is in sRGB + alpha. Example usage: -@code + +@code{.cpp} Math::Vector4 a = 0x33b27fcc_srgba; // {0x33, 0xb2, 0x7f, 0xcc} @endcode @attention Note that colors in sRGB representation should not be used directly - in calculations -- they should be converted to linear RGB, calculation done - on the linear representation and then converted back to sRGB. Use the + in calculations --- they should be converted to linear RGB, calculation + done on the linear representation and then converted back to sRGB. Use the @link operator""_srgbaf() @endlink literal if you want to get a linear RGBA representation directly or convert the value using @ref Color4::fromSrgbAlpha(). @@ -1087,7 +1104,8 @@ constexpr Vector4 operator "" _srgba(unsigned long long value) { @brief Float linear RGB literal Unpacks the 8-bit values into three floats. Example usage: -@code + +@code{.cpp} Color3 a = 0x33b27f_rgbf; // {0.2f, 0.698039f, 0.498039f} @endcode @@ -1108,9 +1126,11 @@ inline Color3 operator "" _rgbf(unsigned long long value) { Unpacks the 8-bit values into three floats and converts the color space from sRGB to linear RGB. See @ref Color3::fromSrgb() for more information. Example usage: -@code + +@code{.cpp} Color3 a = 0x33b27f_srgbf; // {0.0331048f, 0.445201f, 0.212231f} @endcode + @see @link operator""_srgbaf() @endlink, @link operator""_srgb() @endlink, @link operator""_rgbf() @endlink */ @@ -1122,7 +1142,8 @@ inline Color3 operator "" _srgbf(unsigned long long value) { @brief Float linear RGBA literal Unpacks the 8-bit values into four floats. Example usage: -@code + +@code{.cpp} Color4 a = 0x33b27fcc_rgbaf; // {0.2f, 0.698039f, 0.498039f, 0.8f} @endcode @@ -1143,9 +1164,11 @@ inline Color4 operator "" _rgbaf(unsigned long long value) { Unpacks the 8-bit values into four floats and converts the color space from sRGB + alpha to linear RGBA. See @ref Color4::fromSrgbAlpha() for more information. Example usage: -@code + +@code{.cpp} Color4 a = 0x33b27fcc_srgbaf; // {0.0331048f, 0.445201f, 0.212231f, 0.8f} @endcode + @see @link operator""_srgbf() @endlink, @link operator""_srgba() @endlink, @link operator""_rgbaf() @endlink */ @@ -1158,16 +1181,16 @@ inline Color4 operator "" _srgbaf(unsigned long long value) { /** @debugoperator{Magnum::Math::Color3} -Prints the value as hex color (e.g. `#ff33aa`). Other underlying types are -handled by @ref operator<<(Corrade::Utility::Debug&, const Vector&). +Prints the value as hex color (e.g. @cb{.shell-session} #ff33aa @ce). Other +underlying types are handled by @ref operator<<(Corrade::Utility::Debug&, const Vector&). */ MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color3& value); /** @debugoperator{Magnum::Math::Color4} -Prints the value as hex color (e.g. `#9933aaff`). Other underlying types are -handled by @ref operator<<(Corrade::Utility::Debug&, const Vector&). +Prints the value as hex color (e.g. @cb{.shell-session} #9933aaff @ce). Other +underlying types are handled by @ref operator<<(Corrade::Utility::Debug&, const Vector&). */ MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color4& value); diff --git a/src/Magnum/Math/Dual.h b/src/Magnum/Math/Dual.h index f99fa5956..99975a09f 100644 --- a/src/Magnum/Math/Dual.h +++ b/src/Magnum/Math/Dual.h @@ -98,7 +98,8 @@ template class Dual { * * Performs only default casting on the values, no rounding or anything * else. Example usage: - * @code + * + * @code{.cpp} * Dual floatingPoint(1.3f, 2.7f); * Dual integral(floatingPoint); * // integral == {1, 2} diff --git a/src/Magnum/Math/DualComplex.h b/src/Magnum/Math/DualComplex.h index 89e48a08b..475ebedf0 100644 --- a/src/Magnum/Math/DualComplex.h +++ b/src/Magnum/Math/DualComplex.h @@ -271,7 +271,7 @@ template class DualComplex: public Dual> { /** * @brief Complex number length squared * - * Should be used instead of length() for comparing complex number + * Should be used instead of @ref length() for comparing complex number * length with other values, because it doesn't compute the square root. @f[ * |\hat c|^2 = c_0 \cdot c_0 = |c_0|^2 * @f] @@ -284,8 +284,8 @@ template class DualComplex: public Dual> { /** * @brief Dual quaternion length * - * See lengthSquared() which is faster for comparing length with other - * values. @f[ + * See @ref lengthSquared() which is faster for comparing length with + * other values. @f[ * |\hat c| = \sqrt{c_0 \cdot c_0} = |c_0| * @f] * @todo can this be done similarly to dual quaternions? @@ -310,8 +310,8 @@ template class DualComplex: public Dual> { /** * @brief Inverted dual complex number * - * See invertedNormalized() which is faster for normalized dual complex - * numbers. @f[ + * See @ref invertedNormalized() which is faster for normalized dual + * complex numbers. @f[ * \hat c^{-1} = c_0^{-1} - \epsilon c_\epsilon * @f] * @todo can this be done similarly to dual quaternions? @@ -336,8 +336,8 @@ template class DualComplex: public Dual> { /** * @brief Rotate and translate point with dual complex number * - * See transformPointNormalized(), which is faster for normalized dual - * complex number. @f[ + * See @ref transformPointNormalized(), which is faster for normalized + * dual complex number. @f[ * v' = \hat c v = \hat c ((0 + i) + \epsilon(v_x + iv_y)) * @f] * @see @ref DualComplex(const Vector2&), @ref dual(), diff --git a/src/Magnum/Math/Functions.h b/src/Magnum/Math/Functions.h index def95b4cc..64bf44089 100644 --- a/src/Magnum/Math/Functions.h +++ b/src/Magnum/Math/Functions.h @@ -93,12 +93,15 @@ template T exp(T exponent) { return std::exp(exponent); } @brief Integer division with remainder Example usage: -@code + +@code{.cpp} Int quotient, remainder; std::tie(quotient, remainder) = Math::div(57, 6); // {9, 3} @endcode + Equivalent to the following, but possibly done in a single CPU instruction: -@code + +@code{.cpp} Int quotient = 57/6; Int remainder = 57%6; @endcode @@ -370,9 +373,11 @@ template inline std::pair minmax(std::initializer_list list) { Values smaller than @p min are set to @p min, values larger than @p max are set to @p max. Equivalent to: -@code + +@code{.cpp} Math::min(Math::max(value, min), max) @endcode + NaNs passed in @p value parameter are propagated. @see @ref min(), @ref max() */ @@ -546,9 +551,7 @@ template inline typename std::enable_if a{3.14159_h, -1.4142_h, 1.618_h}; Vector3 b{a}; // converts to 32-bit floats Debug{} << a; // prints {3.14159, -1.4142, 1.618} diff --git a/src/Magnum/Math/Matrix.h b/src/Magnum/Math/Matrix.h index 511224e31..2814953a3 100644 --- a/src/Magnum/Math/Matrix.h +++ b/src/Magnum/Math/Matrix.h @@ -122,7 +122,8 @@ template class Matrix: public RectangularMatrix floatingPoint({1.3f, 2.7f}, * {-15.0f, 7.0f}); * Matrix2x2 integral(floatingPoint); diff --git a/src/Magnum/Math/Matrix3.h b/src/Magnum/Math/Matrix3.h index fe8e78d21..41566bfed 100644 --- a/src/Magnum/Math/Matrix3.h +++ b/src/Magnum/Math/Matrix3.h @@ -110,8 +110,8 @@ template class Matrix3: public Matrix3x3 { * * Expects that the normal is normalized. Reflection along axes can be * done in a slightly simpler way also using @ref scaling(), e.g. - * `Matrix3::reflection(Vector2::yAxis())` is equivalent to - * `Matrix3::scaling(Vector2::yScale(-1.0f))`. @f[ + * @cpp Matrix3::reflection(Vector2::yAxis()) @ce is equivalent to + * @cpp Matrix3::scaling(Vector2::yScale(-1.0f)) @ce. @f[ * \boldsymbol{A} = \boldsymbol{I} - 2 \boldsymbol{NN}^T ~~~~~ \boldsymbol{N} = \begin{pmatrix} n_x \\ n_y \end{pmatrix} * @f] * @see @ref Matrix4::reflection(), @ref Vector::isNormalized() diff --git a/src/Magnum/Math/Matrix4.h b/src/Magnum/Math/Matrix4.h index fa730006c..63bfdd3e9 100644 --- a/src/Magnum/Math/Matrix4.h +++ b/src/Magnum/Math/Matrix4.h @@ -124,7 +124,7 @@ template class Matrix4: public Matrix4x4 { * @brief 3D rotation matrix around X axis * @param angle Rotation angle (counterclockwise) * - * Faster than calling `Matrix4::rotation(angle, Vector3::xAxis())`. @f[ + * Faster than calling @cpp Matrix4::rotation(angle, Vector3::xAxis()) @ce. @f[ * \boldsymbol{A} = \begin{pmatrix} * 1 & 0 & 0 & 0 \\ * 0 & \cos\theta & -\sin\theta & 0 \\ @@ -142,7 +142,7 @@ template class Matrix4: public Matrix4x4 { * @brief 3D rotation matrix around Y axis * @param angle Rotation angle (counterclockwise) * - * Faster than calling `Matrix4::rotation(angle, Vector3::yAxis())`. @f[ + * Faster than calling @cpp Matrix4::rotation(angle, Vector3::yAxis()) @ce. @f[ * \boldsymbol{A} = \begin{pmatrix} * \cos\theta & 0 & \sin\theta & 0 \\ * 0 & 1 & 0 & 0 \\ @@ -160,7 +160,7 @@ template class Matrix4: public Matrix4x4 { * @brief 3D rotation matrix around Z axis * @param angle Rotation angle (counterclockwise) * - * Faster than calling `Matrix4::rotation(angle, Vector3::zAxis())`. @f[ + * Faster than calling @cpp Matrix4::rotation(angle, Vector3::zAxis()) @ce. @f[ * \boldsymbol{A} = \begin{pmatrix} * \cos\theta & -\sin\theta & 0 & 0 \\ * \sin\theta & \cos\theta & 0 & 0 \\ @@ -180,8 +180,8 @@ template class Matrix4: public Matrix4x4 { * * Expects that the normal is normalized. Reflection along axes can be * done in a slightly simpler way also using @ref scaling(), e.g. - * `Matrix4::reflection(Vector3::yAxis())` is equivalent to - * `Matrix4::scaling(Vector3::yScale(-1.0f))`. @f[ + * @cpp Matrix4::reflection(Vector3::yAxis()) @ce is equivalent to + * @cpp Matrix4::scaling(Vector3::yScale(-1.0f)) @ce. @f[ * \boldsymbol{A} = \boldsymbol{I} - 2 \boldsymbol{NN}^T ~~~~~ \boldsymbol{N} = \begin{pmatrix} n_x \\ n_y \\ n_z \end{pmatrix} * @f] * @see @ref Matrix3::reflection(), @ref Vector::isNormalized() @@ -340,7 +340,7 @@ template class Matrix4: public Matrix4x4 { * @param eye Location to place the matrix * @param target Location towards which the matrix is oriented * @param up Vector as a guide of which way is up (should not be - * the same direction as `target - eye`) + * the same direction as @cpp target - eye @ce) * * @attention This function transforms an object so it's at @p eye * position and oriented towards @p target, it does *not* produce diff --git a/src/Magnum/Math/Packing.h b/src/Magnum/Math/Packing.h index 86b348b69..a54ad5597 100644 --- a/src/Magnum/Math/Packing.h +++ b/src/Magnum/Math/Packing.h @@ -53,16 +53,17 @@ value in range @f$ [0, 1] @f$ or from *signed* integral to range @f$ [-1, 1] @f$ @ref Magnum::Short "Short", @ref Magnum::Double "Double" from @ref Magnum::Int "Int" and similarly for vector types). -@attention To ensure the integral type is correctly detected when using - literals, this function should be called with both template parameters - explicit, e.g.: -@code -// Literal type is (signed) char, but we assumed unsigned char, a != 1.0f -Float a = Math::unpack('\xFF'); - -// b = 1.0f -Float b = Math::unpack('\xFF'); -@endcode +@attention + To ensure the integral type is correctly detected when using literals, this + function should be called with both template parameters explicit, e.g.: +@attention + @code{.cpp} + // Literal type is (signed) char, but we assumed unsigned char, a != 1.0f + Float a = Math::unpack('\xFF'); + + // b = 1.0f + Float b = Math::unpack('\xFF'); + @endcode @see @ref pack() */ @@ -73,7 +74,8 @@ template inline FloatingPoint unpack(const Alternative to the above with ability to specify how many bits of the integral representation to use. Example usage: -@code + +@code{.cpp} Float a = Math::unpack(8191); // 0.124987f Float b = Math::unpack(8191); // 0.499969f Float b = Math::unpack(8191u); // 0.499969f @@ -170,7 +172,8 @@ template(0.5f); // 32767 auto b = Math::pack(0.5f); // 8191 @endcode diff --git a/src/Magnum/Math/Range.h b/src/Magnum/Math/Range.h index 015726d5b..1fac0d288 100644 --- a/src/Magnum/Math/Range.h +++ b/src/Magnum/Math/Range.h @@ -89,7 +89,8 @@ template class Range { * * Performs only default casting on the values, no rounding or * anything else. Example usage: - * @code + * + * @code{.cpp} * Range2D floatingPoint({1.3f, 2.7f}, {-15.0f, 7.0f}); * Range2D integral(floatingPoint); // {{1, 2}, {-15, 7}} * @endcode @@ -215,7 +216,7 @@ template class Range { /** @brief One-dimensional range -Convenience alternative to `Range<1, T>`. See @ref Range for more +Convenience alternative to @cpp Range<1, T> @ce. See @ref Range for more information. */ #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Multiple definitions still broken */ diff --git a/src/Magnum/Math/RectangularMatrix.h b/src/Magnum/Math/RectangularMatrix.h index 43231c165..b82daa34f 100644 --- a/src/Magnum/Math/RectangularMatrix.h +++ b/src/Magnum/Math/RectangularMatrix.h @@ -141,7 +141,8 @@ template class RectangularMatrix { * * Performs only default casting on the values, no rounding or * anything else. Example usage: - * @code + * + * @code{.cpp} * RectangularMatrix<4, 1, Float> floatingPoint(1.3f, 2.7f, -15.0f, 7.0f); * RectangularMatrix<4, 1, Byte> integral(floatingPoint); * // integral == {1, 2, -15, 7} @@ -175,7 +176,8 @@ template class RectangularMatrix { * * Particular elements can be accessed using @ref Vector::operator[](), * e.g.: - * @code + * + * @code{.cpp} * RectangularMatrix<4, 3, Float> m; * Float a = m[2][1]; * @endcode @@ -469,7 +471,7 @@ template class RectangularMatrix { /** @brief Matrix with 2 columns and 3 rows -Convenience alternative to `RectangularMatrix<2, 3, T>`. See +Convenience alternative to @cpp RectangularMatrix<2, 3, T> @ce. See @ref RectangularMatrix for more information. @see @ref Magnum::Matrix2x3, @ref Magnum::Matrix2x3d */ @@ -480,7 +482,7 @@ template using Matrix2x3 = RectangularMatrix<2, 3, T>; /** @brief Matrix with 3 columns and 2 rows -Convenience alternative to `RectangularMatrix<3, 2, T>`. See +Convenience alternative to @cpp RectangularMatrix<3, 2, T> @ce. See @ref RectangularMatrix for more information. @see @ref Magnum::Matrix3x2, @ref Magnum::Matrix3x2d */ @@ -491,7 +493,7 @@ template using Matrix3x2 = RectangularMatrix<3, 2, T>; /** @brief Matrix with 2 columns and 4 rows -Convenience alternative to `RectangularMatrix<2, 4, T>`. See +Convenience alternative to @cpp RectangularMatrix<2, 4, T> @ce. See @ref RectangularMatrix for more information. @see @ref Magnum::Matrix2x4, @ref Magnum::Matrix2x4d */ @@ -502,7 +504,7 @@ template using Matrix2x4 = RectangularMatrix<2, 4, T>; /** @brief Matrix with 4 columns and 2 rows -Convenience alternative to `RectangularMatrix<4, 2, T>`. See +Convenience alternative to @cpp RectangularMatrix<4, 2, T> @ce. See @ref RectangularMatrix for more information. @see @ref Magnum::Matrix4x2, @ref Magnum::Matrix4x2d */ @@ -513,7 +515,7 @@ template using Matrix4x2 = RectangularMatrix<4, 2, T>; /** @brief Matrix with 3 columns and 4 rows -Convenience alternative to `RectangularMatrix<3, 4, T>`. See +Convenience alternative to @cpp RectangularMatrix<3, 4, T> @ce. See @ref RectangularMatrix for more information. @see @ref Magnum::Matrix3x4, @ref Magnum::Matrix3x4d */ @@ -524,7 +526,7 @@ template using Matrix3x4 = RectangularMatrix<3, 4, T>; /** @brief Matrix with 4 columns and 3 rows -Convenience alternative to `RectangularMatrix<4, 3, T>`. See +Convenience alternative to @cpp RectangularMatrix<4, 3, T> @ce. See @ref RectangularMatrix for more information. @see @ref Magnum::Matrix4x3, @ref Magnum::Matrix4x3d */ diff --git a/src/Magnum/Math/Swizzle.h b/src/Magnum/Math/Swizzle.h index 5313fcdef..c4709b6aa 100644 --- a/src/Magnum/Math/Swizzle.h +++ b/src/Magnum/Math/Swizzle.h @@ -65,17 +65,20 @@ namespace Implementation { @brief Swizzle Vector components Creates new vector from given components. Example: -@code + +@code{.cpp} Vector4i original(-1, 2, 3, 4); auto vec = swizzle<'w', '1', '0', 'x', 'y', 'z'>(original); // vec == { 4, 1, 0, -1, 2, 3 } @endcode -You can use letters `x`, `y`, `z`, `w` and `r`, `g`, `b`, `a` for addressing -components or letters `0` and `1` for zero and one. Count of elements is -unlimited, but must be at least one. If the resulting vector is two, three or -four-component, corresponding @ref Math::Vector2, @ref Math::Vector3, -@ref Math::Vector4, @ref Color3 or @ref Color4 specialization is returned. + +You can use letters @cpp 'x' @ce, @cpp 'y' @ce, @cpp 'z' @ce, @cpp 'w' @ce and +@cpp 'r' @ce, @cpp 'g' @ce, @cpp 'b' @ce, @cpp 'a' @ce for addressing +components or letters @cpp '0' @ce and @cpp '1' @ce for zero and one. Count of +elements is unlimited, but must be at least one. If the resulting vector is +two, three or four-component, corresponding @ref Vector2, @ref Vector3, +@ref Vector4, @ref Color3 or @ref Color4 specialization is returned. @see @ref matrix-vector-component-access, @ref Vector4::xyz(), @ref Vector4::rgb(), @ref Vector4::xy(), @ref Vector3::xy() diff --git a/src/Magnum/Math/TypeTraits.h b/src/Magnum/Math/TypeTraits.h index 334260e33..08d4b7abf 100644 --- a/src/Magnum/Math/TypeTraits.h +++ b/src/Magnum/Math/TypeTraits.h @@ -145,7 +145,8 @@ template struct TypeTraits: Implementation::TypeTraitsDefault { * comparing e.g. a calculated nearly-zero difference with zero, knowing * the magnitude of original values so the epsilon can be properly scaled. * In other words, the following lines are equivalent: - * @code + * + * @code{.cpp} * Float a, b; * Math::TypeTraits::equals(a, b); * Math::TypeTraits::equalsZero(a - b, Math::max(Math::abs(a), Math::abs(b))); diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index c6ac19da8..94c814ad3 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -199,7 +199,8 @@ template class Vector { * * Performs only default casting on the values, no rounding or * anything else. Example usage: - * @code + * + * @code{.cpp} * Vector<4, Float> floatingPoint(1.3f, 2.7f, -15.0f, 7.0f); * Vector<4, Byte> integral(floatingPoint); * // integral == {1, 2, -15, 7} @@ -496,9 +497,11 @@ template class Vector { * Convenience equivalent to the following code. Due to operation order * this function is faster than the obvious way of sizing * @ref normalized() vector. - * @code - * vec*(vec.lengthInverted()*length) // the brackets are important + * + * @code{.cpp} + * vec*(vec.lengthInverted()*length) // the parentheses are important * @endcode + * * @see @ref normalized() */ Vector resized(T length) const { @@ -511,7 +514,7 @@ template class Vector { * Returns vector projected onto @p line. @f[ * \boldsymbol a_1 = \frac{\boldsymbol a \cdot \boldsymbol b}{\boldsymbol b \cdot \boldsymbol b} \boldsymbol b * @f] - * @see @ref dot(), @ref projectedOntoNormalized() + * @see @ref Math::dot(), @ref projectedOntoNormalized() */ Vector projected(const Vector& line) const { return line*Math::dot(*this, line)/line.dot(); @@ -525,7 +528,7 @@ template class Vector { * \boldsymbol a_1 = \frac{\boldsymbol a \cdot \boldsymbol b}{\boldsymbol b \cdot \boldsymbol b} \boldsymbol b = * (\boldsymbol a \cdot \boldsymbol b) \boldsymbol b * @f] - * @see @ref dot() const + * @see @ref Math::dot() */ Vector projectedOntoNormalized(const Vector& line) const; diff --git a/src/Magnum/Math/Vector2.h b/src/Magnum/Math/Vector2.h index 2272593e3..cda88db58 100644 --- a/src/Magnum/Math/Vector2.h +++ b/src/Magnum/Math/Vector2.h @@ -66,9 +66,11 @@ template class Vector2: public Vector<2, T> { * @brief Vector in direction of X axis (right) * * Usable for translation in given axis, for example: - * @code + * + * @code{.cpp} * Matrix3::translation(Vector2::xAxis(5.0f)); // same as Matrix3::translation({5.0f, 0.0f}); * @endcode + * * @see @ref yAxis(), @ref xScale(), @ref Matrix3::right() */ constexpr static Vector2 xAxis(T length = T(1)) { return {length, T(0)}; } @@ -85,9 +87,11 @@ template class Vector2: public Vector<2, T> { * @brief Scaling vector in direction of X axis (width) * * Usable for scaling along given direction, for example: - * @code + * + * @code{.cpp} * Matrix3::scaling(Vector2::xScale(-2.0f)); // same as Matrix3::scaling({-2.0f, 1.0f}); * @endcode + * * @see @ref yScale(), @ref xAxis() */ constexpr static Vector2 xScale(T scale) { return {scale, T(1)}; } diff --git a/src/Magnum/Math/Vector3.h b/src/Magnum/Math/Vector3.h index a098ec39d..c87719502 100644 --- a/src/Magnum/Math/Vector3.h +++ b/src/Magnum/Math/Vector3.h @@ -70,10 +70,12 @@ template class Vector3: public Vector<3, T> { * @brief Vector in direction of X axis (right) * * Usable for translation or rotation along given axis, for example: - * @code + * + * @code{.cpp} * Matrix4::translation(Vector3::xAxis(5.0f)); // same as Matrix4::translation({5.0f, 0.0f, 0.0f}); * Matrix4::rotation(30.0_degf, Vector3::xAxis()); // same as Matrix::rotation(30.0_degf, {1.0f, 0.0f, 0.0f}); * @endcode + * * @see @ref yAxis(), @ref zAxis(), @ref xScale(), @ref Color3::red(), * @ref Matrix4::right() */ @@ -99,9 +101,11 @@ template class Vector3: public Vector<3, T> { * @brief Scaling vector in direction of X axis (width) * * Usable for scaling along given direction, for example: - * @code + * + * @code{.cpp} * Matrix4::scaling(Vector3::xScale(-2.0f)); // same as Matrix4::scaling({-2.0f, 1.0f, 1.0f}); * @endcode + * * @see @ref yScale(), @ref zScale(), @ref Color3::cyan(), @ref xAxis() */ constexpr static Vector3 xScale(T scale) { return {scale, T(1), T(1)}; }