namespace
MathMath library.
Template classes for matrix and vector calculations.
This library is built as part of Magnum by default. To use this library with CMake, find the Magnum
package and link to the Magnum::Magnum
target:
find_package(Magnum REQUIRED) # ... target_link_libraries(your-app PRIVATE Magnum::Magnum)
See Downloading and building, Usage with CMake, Operations with matrices and vectors and 2D and 3D transformations for more information.
Namespaces
- namespace Algorithms
- Algorithms.
- namespace Distance
- Functions for calculating distances.
- namespace Intersection
- Functions for calculating intersections.
- namespace Literals
- Math literals.
Classes
-
template<UnsignedInt order, UnsignedInt dimensions, class T>class Bezier
- Bézier curve.
-
template<std::class BitVector new in Git master
size_t size> - Vector of bits.
-
template<class T>class Color3
- Color in linear RGB color space.
-
template<class T = Float>class Color4
- Color in linear RGBA color space.
-
template<class T>struct ColorHsv new in 2019.10
- HSV color.
-
template<class T>class Complex
- Complex number.
-
template<class T>struct Constants
- Numeric constants.
-
template<class T>class CubicHermite
- Cubic Hermite spline point.
-
template<class T>class Deg
- Angle in degrees.
-
template<class T>class Dual
- Dual number.
-
template<class T>class DualComplex
- Dual complex number.
-
template<class T>class DualQuaternion
- Dual quaternion.
-
template<class T>class Frustum
- Camera frustum.
- class Half
- Half-precision float literal.
- struct IdentityInitT
- Identity initialization tag type.
-
template<class T>struct IsFloatingPoint new in 2019.10
- Whether
T
is floating-point. -
template<class T>struct IsIntegral new in 2019.10
- Whether
T
is integral. -
template<class T>struct IsScalar new in 2019.10
- Whether
T
is an arithmetic scalar type. -
template<class T>struct IsUnitless new in 2019.10
- Whether
T
is a unitless type. -
template<class T>struct IsVector new in 2019.10
- Whether
T
is an arithmetic vector type. -
template<std::class Matrix
size_t size, class T> - Square matrix.
-
template<class T>class Matrix3
- 2D transformation matrix
-
template<class T>class Matrix4
- 3D transformation matrix
-
template<class T>class Nanoseconds new in Git master
- Nanoseconds.
-
template<class T>class Quaternion
- Quaternion.
-
template<class T>class Rad
- Angle in radians.
-
template<UnsignedInt dimensions, class T>class Range
- N-dimensional range.
-
template<class T>class Range2D
- Two-dimensional range.
-
template<class T>class Range3D
- Three-dimensional range.
-
template<std::class RectangularMatrix
size_t cols, std:: size_t rows, class T> - Rectangular matrix.
-
template<class T>class Seconds new in Git master
- Seconds.
- struct StrictWeakOrdering
- A functor which implements strict weak ordering.
-
template<class T>struct TypeTraits
- Traits class for builtin arithmetic types.
-
template<template<class> class Derived, class T>class Unit
- Base class for units.
-
template<std::class Vector
size_t size, class T> - Vector.
-
template<class T>class Vector2
- Two-component vector.
-
template<class T>class Vector3
- Three-component vector.
-
template<class T>class Vector4
- Four-component vector.
- struct ZeroInitT
- Zero initialization tag type.
Typedefs
-
template<UnsignedInt dimensions, class T>using QuadraticBezier = Bezier<2, dimensions, T>
- Quadratic Bézier curve.
-
template<class T>using QuadraticBezier2D = QuadraticBezier<2, T>
- Two-dimensional quadratic Bézier curve.
-
template<class T>using QuadraticBezier3D = QuadraticBezier<3, T>
- Three-dimensional quadratic Bézier curve.
-
template<UnsignedInt dimensions, class T>using CubicBezier = Bezier<3, dimensions, T>
- Cubic Bézier curve.
-
template<class T>using CubicBezier2D = CubicBezier<2, T>
- Two-dimensional cubic Bézier curve.
-
template<class T>using CubicBezier3D = CubicBezier<3, T>
- Three-dimensional cubic Bézier curve.
-
template<std::using BoolVector = BitVector<size> deprecated in Git master
size_t size> - Vector of bits.
-
template<class T>using CubicHermite1D = CubicHermite<T>
- Scalar cubic Hermite spline point.
-
template<class T>using CubicHermite2D = CubicHermite<Vector2<T>>
- Two-dimensional cubic Hermite spline point.
-
template<class T>using CubicHermite3D = CubicHermite<Vector3<T>>
- Three-dimensional cubic Hermite spline point.
-
template<class T>using CubicHermiteComplex = CubicHermite<Complex<T>>
- Cubic Hermite spline complex number.
-
template<class T>using CubicHermiteQuaternion = CubicHermite<Quaternion<T>>
- Cubic Hermite spline quaternion.
-
template<class T>using Matrix2x2 = Matrix<2, T>
- 2x2 matrix
-
template<class T>using Matrix3x3 = Matrix<3, T>
- 3x3 matrix
-
template<class T>using Matrix4x4 = Matrix<4, T>
- 4x4 matrix
-
template<class T>using Range1D = Range<1, T>
- One-dimensional range.
-
template<class T>using Matrix2x1 = RectangularMatrix<2, 1, T> new in Git master
- Matrix with 2 columns and 1 row.
-
template<class T>using Matrix2x3 = RectangularMatrix<2, 3, T>
- Matrix with 2 columns and 3 rows.
-
template<class T>using Matrix2x4 = RectangularMatrix<2, 4, T>
- Matrix with 2 columns and 4 rows.
-
template<class T>using Matrix3x1 = RectangularMatrix<3, 1, T> new in Git master
- Matrix with 3 columns and 1 row.
-
template<class T>using Matrix3x2 = RectangularMatrix<3, 2, T>
- Matrix with 3 columns and 2 rows.
-
template<class T>using Matrix3x4 = RectangularMatrix<3, 4, T>
- Matrix with 3 columns and 4 rows.
-
template<class T>using Matrix4x1 = RectangularMatrix<4, 1, T> new in Git master
- Matrix with 4 columns and 1 row.
-
template<class T>using Matrix4x2 = RectangularMatrix<4, 2, T>
- Matrix with 4 columns and 2 rows.
-
template<class T>using Matrix4x3 = RectangularMatrix<4, 3, T>
- Matrix with 4 columns and 3 rows.
-
using NoInitT = Magnum::
NoInitT deprecated in 2020.06 - No initialization tag type.
-
template<class T>using UnderlyingTypeOf = typename Implementation::UnderlyingType<T>::Type new in 2019.10
- Underlying type of a math type.
Functions
-
template<class T>auto operator<<(Utility::
Debug& debug, const Unit<Rad, T>& value) -> Utility:: Debug& - Debug output operator.
-
template<class T>auto operator<<(Utility::
Debug& debug, const Unit<Deg, T>& value) -> Utility:: Debug& - Debug output operator.
-
template<UnsignedInt order, UnsignedInt dimensions, class T>auto operator<<(Debug& debug, const Bezier<order, dimensions, T>& value) -> Utility::
Debug& - Debug output operator.
-
template<std::auto operator<<(Debug& debug, const BitVector<size>& value) -> Debug& new in Git master
size_t size> - Debug output operator.
-
template<class T>auto xyYToXyz(const Vector3<T>& xyY) -> Vector3<T>
- Convert color from CIE xyY representation to CIE XYZ.
-
template<class T>auto xyzToXyY(const Vector3<T>& xyz) -> Vector3<T>
- Convert color from CIE XYZ representation to CIE xyY
-
template<class T>auto operator<<(Debug& debug, const ColorHsv<T>& value) -> Debug&
- Debug output operator.
- auto operator<<(Debug& debug, const Color3<UnsignedByte>& value) -> Debug&
- Debug output operator.
- auto operator<<(Debug& debug, const Color4<UnsignedByte>& value) -> Debug&
- Debug output operator.
-
void yFlipBc1InPlace(const Containers::
StridedArrayView4D<char>& blocks) new in Git master - Y-flip BC1 texture blocks in-place.
-
void yFlipBc2InPlace(const Containers::
StridedArrayView4D<char>& blocks) new in Git master - Y-flip BC2 texture blocks in-place.
-
void yFlipBc3InPlace(const Containers::
StridedArrayView4D<char>& blocks) new in Git master - Y-flip BC3 texture blocks in-place.
-
void yFlipBc4InPlace(const Containers::
StridedArrayView4D<char>& blocks) new in Git master - Y-flip BC4 texture blocks in-place.
-
void yFlipBc5InPlace(const Containers::
StridedArrayView4D<char>& blocks) new in Git master - Y-flip BC5 texture blocks in-place.
-
template<class T>auto dot(const Complex<T>& a, const Complex<T>& b) -> T
- Dot product of two complex numbers.
-
template<class T>auto angle(const Complex<T>& normalizedA, const Complex<T>& normalizedB) -> Rad<T>
- Angle between normalized complex numbers.
-
template<class T>auto operator*(const Vector2<T>& vector, const Complex<T>& complex) -> Complex<T>
- Multiply a vector with a complex number.
-
template<class T>auto lerp(const Complex<T>& normalizedA, const Complex<T>& normalizedB, T t) -> Complex<T>
- Linear interpolation of two complex numbers.
-
template<class T>auto slerp(const Complex<T>& normalizedA, const Complex<T>& normalizedB, T t) -> Complex<T>
- Spherical linear interpolation of two complex numbers.
-
template<class T>auto operator<<(Debug& debug, const Complex<T>& value) -> Debug&
- Debug output operator.
-
template<class T>auto operator<<(Debug& debug, const CubicHermite<T>& value) -> Debug&
- Debug output operator.
-
template<class T, class U>auto select(const CubicHermite<T>& a, const CubicHermite<T>& b, U t) -> T
- Constant interpolation of two cubic Hermite spline points.
-
template<class T, class U>auto lerp(const CubicHermite<T>& a, const CubicHermite<T>& b, U t) -> T
- Linear interpolation of two cubic Hermite points.
-
template<class T>auto lerp(const CubicHermiteComplex<T>& a, const CubicHermiteComplex<T>& b, T t) -> Complex<T>
- Linear interpolation of two cubic Hermite complex numbers.
-
template<class T>auto lerp(const CubicHermiteQuaternion<T>& a, const CubicHermiteQuaternion<T>& b, T t) -> Quaternion<T>
- Linear interpolation of two cubic Hermite quaternions.
-
template<class T>auto lerpShortestPath(const CubicHermiteQuaternion<T>& a, const CubicHermiteQuaternion<T>& b, T t) -> Quaternion<T>
- Linear shortest-path interpolation of two cubic Hermite quaternions.
-
template<class T>auto slerp(const CubicHermiteComplex<T>& a, const CubicHermiteComplex<T>& b, T t) -> Complex<T>
- Spherical linear interpolation of two cubic Hermite complex numbers.
-
template<class T>auto slerp(const CubicHermiteQuaternion<T>& a, const CubicHermiteQuaternion<T>& b, T t) -> Quaternion<T>
- Spherical linear interpolation of two cubic Hermite quaternions.
-
template<class T>auto slerpShortestPath(const CubicHermiteQuaternion<T>& a, const CubicHermiteQuaternion<T>& b, T t) -> Quaternion<T>
- Spherical linear shortest-path interpolation of two cubic Hermite quaternions.
-
template<class T, class U>auto splerp(const CubicHermite<T>& a, const CubicHermite<T>& b, U t) -> T
- Spline interpolation of two cubic Hermite points.
-
template<class T>auto splerp(const CubicHermiteComplex<T>& a, const CubicHermiteComplex<T>& b, T t) -> Complex<T>
- Spline interpolation of two cubic Hermite complex numbers.
-
template<class T>auto splerp(const CubicHermiteQuaternion<T>& a, const CubicHermiteQuaternion<T>& b, T t) -> Quaternion<T>
- Spline interpolation of two cubic Hermite quaternions.
-
template<class T>auto operator<<(Debug& debug, const Dual<T>& value) -> Debug&
- Debug output operator.
-
template<class T>auto sqrt(const Dual<T>& dual) -> Dual<T>
- Square root of dual number.
-
template<class T>auto sincos(const Dual<Rad<T>>& angle) -> Containers::
Pair<Dual<T>, Dual<T>> - Sine and cosine of dual angle.
-
template<class T>auto operator<<(Debug& debug, const DualComplex<T>& value) -> Debug&
- Debug output operator.
-
template<class T>auto sclerp(const DualQuaternion<T>& normalizedA, const DualQuaternion<T>& normalizedB, const T t) -> DualQuaternion<T>
- Screw linear interpolation of two dual quaternions.
-
template<class T>auto sclerpShortestPath(const DualQuaternion<T>& normalizedA, const DualQuaternion<T>& normalizedB, const T t) -> DualQuaternion<T>
- Screw linear shortest-path interpolation of two dual quaternions.
-
template<class T>auto operator<<(Debug& debug, const DualQuaternion<T>& value) -> Debug&
- Debug output operator.
-
template<class T>auto operator<<(Debug& debug, const Frustum<T>& value) -> Debug&
- Debug output operator.
-
template<class Integral>auto div(Integral x, Integral y) -> Containers::
Pair<Integral, Integral> - Integer division with remainder.
- auto binomialCoefficient(UnsignedInt n, UnsignedInt k) -> UnsignedLong new in Git master
- Binomial coefficient.
- auto popcount(UnsignedInt number) -> UnsignedInt new in Git master
- Count of bits set in a number.
- auto popcount(UnsignedLong number) -> UnsignedInt new in Git master
-
template<std::auto reflect(const Vector<size, T>& vector, const Vector<size, T>& normal) -> Vector<size, T> new in 2020.06
size_t size, class T> - Reflect a vector.
-
template<std::auto refract(const Vector<size, T>& vector, const Vector<size, T>& normal, T eta) -> Vector<size, T> new in 2020.06
size_t size, class T> - Refract a vector.
- auto operator<<(Debug& debug, Half value) -> Debug&
- Debug output operator.
-
template<class T>auto dot(const Quaternion<T>& a, const Quaternion<T>& b) -> T
- Dot product between two quaternions.
-
template<class T>auto halfAngle(const Quaternion<T>& normalizedA, const Quaternion<T>& normalizedB) -> Rad<T>
- Half-angle between normalized quaternions.
-
template<class T>auto angle(const Quaternion<T>& normalizedA, const Quaternion<T>& normalizedB) -> Rad<T> deprecated in Git master
- Half-angle between normalized quaternions.
-
template<class T>auto lerp(const Quaternion<T>& normalizedA, const Quaternion<T>& normalizedB, T t) -> Quaternion<T>
- Linear interpolation of two quaternions.
-
template<class T>auto lerpShortestPath(const Quaternion<T>& normalizedA, const Quaternion<T>& normalizedB, T t) -> Quaternion<T>
- Linear shortest-path interpolation of two quaternions.
-
template<class T>auto slerp(const Quaternion<T>& normalizedA, const Quaternion<T>& normalizedB, T t) -> Quaternion<T>
- Spherical linear interpolation of two quaternions.
-
template<class T>auto slerpShortestPath(const Quaternion<T>& normalizedA, const Quaternion<T>& normalizedB, T t) -> Quaternion<T>
- Spherical linear shortest-path interpolation of two quaternions.
-
template<class T>auto operator<<(Debug& debug, const Quaternion<T>& value) -> Debug&
- Debug output operator.
-
template<UnsignedInt dimensions, class T>auto join(const Range<dimensions, T>& a, const Range<dimensions, T>& b) -> Range<dimensions, T>
- Join two ranges.
-
template<UnsignedInt dimensions, class T>auto join(const Range<dimensions, T>& a, const Vector<dimensions, T>& b) -> Range<dimensions, T> new in Git master
- Join a range and a point.
-
template<UnsignedInt dimensions, class T>auto intersect(const Range<dimensions, T>& a, const Range<dimensions, T>& b) -> Range<dimensions, T>
- Intersect two ranges.
-
template<UnsignedInt dimensions, class T>auto intersects(const Range<dimensions, T>& a, const Range<dimensions, T>& b) -> bool
- Whether two ranges intersect.
-
template<UnsignedInt dimensions, class T>auto operator<<(Debug& debug, const Range<dimensions, T>& value) -> Debug&
- Debug output operator.
-
template<std::auto operator<<(Debug& debug, const Magnum::
size_t cols, std:: size_t rows, class T> Math:: RectangularMatrix<cols, rows, T>& value) -> Debug& - Debug output operator.
-
template<char ... components, class T>auto gather(const T& vector) -> Implementation::TypeForSize<sizeof...(components), T>::Type constexpr new in 2019.10
- Gather Vector components.
-
template<char ... components, class T>auto scatter(const T& vector, const Vector<sizeof...(components), typename T::Type>& values) -> T constexpr new in 2019.10
- Scatter Vector components.
-
auto operator<<(Utility::
Debug& debug, const Unit<Nanoseconds, Long>& value) -> Utility:: Debug& new in Git master - Debug output operator.
-
auto operator<<(Utility::
Debug& debug, const Unit<Seconds, Float>& value) -> Utility:: Debug& new in Git master - Debug output operator.
-
template<class T>auto equal(T a, T b) -> std::
enable_if<IsScalar<T>::value, bool>::type new in 2019.10 - Equality comparison of scalar types.
-
template<class T>auto notEqual(T a, T b) -> std::
enable_if<IsScalar<T>::value, bool>::type new in 2019.10 - Non-equality comparison of scalar types.
-
template<std::auto dot(const Vector<size, T>& a, const Vector<size, T>& b) -> T
size_t size, class T> - Dot product of two vectors.
-
template<std::auto angle(const Vector<size, FloatingPoint>& normalizedA, const Vector<size, FloatingPoint>& normalizedB) -> Rad<FloatingPoint>
size_t size, class FloatingPoint> - Angle between normalized vectors.
-
template<std::auto equal(const Vector<size, T>& a, const Vector<size, T>& b) -> BitVector<size> new in 2019.10
size_t size, class T> - Component-wise equality comparison.
-
template<std::auto notEqual(const Vector<size, T>& a, const Vector<size, T>& b) -> BitVector<size> new in 2019.10
size_t size, class T> - Component-wise non-equality comparison.
-
template<std::auto operator<<(Debug& debug, const Vector<size, T>& value) -> Debug&
size_t size, class T> - Debug output operator.
-
template<class T>auto cross(const Vector2<T>& a, const Vector2<T>& b) -> T
- 2D cross product
-
template<class T>auto cross(const Vector3<T>& a, const Vector3<T>& b) -> Vector3<T>
- Cross product
-
template<class T>auto planeEquation(const Vector3<T>& p0, const Vector3<T>& p1, const Vector3<T>& p2) -> Vector4<T>
- Create a plane equation from three points.
-
template<class T>auto planeEquation(const Vector3<T>& normal, const Vector3<T>& point) -> Vector4<T>
- Create a plane equation from a normal and a point.
Variables
-
Magnum::
NoInitT NoInit deprecated in 2020.06 constexpr - No initialization tag.
- ZeroInitT ZeroInit constexpr
- Zero initialization tag.
- IdentityInitT IdentityInit constexpr
- Identity initialization tag.
Trigonometric functions
Unlike std::
-
template<class T>auto sin(Rad<T> angle) -> T
- Sine.
-
template<class T>auto cos(Rad<T> angle) -> T
- Cosine.
-
template<class T>auto sincos(Rad<T> angle) -> Containers::
Pair<T, T> - Sine and cosine.
-
template<class T>auto tan(Rad<T> angle) -> T
- Tangent.
-
template<class T>auto asin(T value) -> Rad<T>
- Arc sine.
-
template<class T>auto acos(T value) -> Rad<T>
- Arc cosine.
-
template<class T>auto atan(T value) -> Rad<T>
- Arc tangent.
Scalar/vector functions
These functions are overloaded for both scalar and vector types, including Deg and Rad. Scalar versions function exactly as their possible STL equivalents, vector overloads perform the operations component-wise.
-
template<class T>auto isInf(T value) -> std::
enable_if<IsScalar<T>::value, bool>::type new in 2019.10 - If given number is a positive or negative infinity.
-
template<std::auto isInf(const Vector<size, T>& value) -> BitVector<size> new in 2019.10
size_t size, class T> -
template<class T>auto isNan(T value) -> std::
enable_if<IsScalar<T>::value, bool>::type new in 2019.10 - If given number is a NaN.
-
template<std::auto isNan(const Vector<size, T>& value) -> BitVector<size> new in 2019.10
size_t size, class T> -
template<class T>auto min(T value, T min) -> std::
enable_if<IsScalar<T>::value, T>::type constexpr - Minimum.
-
template<std::auto min(const Vector<size, T>& value, const Vector<size, T>& min) -> Vector<size, T>
size_t size, class T> -
template<std::auto min(const Vector<size, T>& value, T min) -> Vector<size, T>
size_t size, class T> -
template<class T>auto max(T a, T b) -> std::
enable_if<IsScalar<T>::value, T>::type constexpr - Maximum.
-
template<std::auto max(const Vector<size, T>& value, const Vector<size, T>& max) -> Vector<size, T>
size_t size, class T> -
template<std::auto max(const Vector<size, T>& value, T max) -> Vector<size, T>
size_t size, class T> -
template<class T>auto minmax(T a, T b) -> std::
enable_if<IsScalar<T>::value, Containers:: Pair<T, T>>::type - Minimum and maximum of two values.
-
template<std::auto minmax(const Vector<size, T>& a, const Vector<size, T>& b) -> Containers::
size_t size, class T> Pair<Vector<size, T>, Vector<size, T>> -
template<class T>auto clamp(T value, T min, T max) -> std::
enable_if<IsScalar<T>::value, T>::type constexpr - Clamp value.
-
template<std::auto clamp(const Vector<size, T>& value, const Vector<size, T>& min, const Vector<size, T>& max) -> Vector<size, T>
size_t size, class T> -
template<std::auto clamp(const Vector<size, T>& value, T min, T max) -> Vector<size, T>
size_t size, class T> -
template<class T>auto sign(T scalar) -> std::
enable_if<IsScalar<T>::value, UnderlyingTypeOf<T>>::type - Sign.
-
template<std::auto sign(const Vector<size, T>& a) -> Vector<size, UnderlyingTypeOf<T>>
size_t size, class T> -
template<class T>auto abs(T a) -> std::
enable_if<IsScalar<T>::value, T>::type - Absolute value.
-
template<std::auto abs(const Vector<size, T>& a) -> Vector<size, T>
size_t size, class T> -
template<class T>auto floor(T a) -> std::
enable_if<IsScalar<T>::value, T>::type - Nearest not larger integer.
-
template<std::auto floor(const Vector<size, T>& a) -> Vector<size, T>
size_t size, class T> -
template<class T>auto round(T a) -> std::
enable_if<IsScalar<T>::value, T>::type - Round value to nearest integer.
-
template<std::auto round(const Vector<size, T>& a) -> Vector<size, T>
size_t size, class T> -
template<class T>auto ceil(T a) -> std::
enable_if<IsScalar<T>::value, T>::type - Nearest not smaller integer.
-
template<std::auto ceil(const Vector<size, T>& a) -> Vector<size, T>
size_t size, class T> -
template<class T>auto fmod(T a, T b) -> std::
enable_if<IsScalar<T>::value, T>::type new in Git master - Floating point division remainder.
-
template<std::auto fmod(const Vector<size, T>& a, const Vector<size, T>& b) -> Vector<size, T> new in Git master
size_t size, class T> -
template<std::auto fmod(const Vector<size, T>& a, T b) -> Vector<size, T> new in Git master
size_t size, class T> -
template<class T, class U>auto lerp(const T& a, const T& b, U t) -> T
- Linear interpolation of two values.
-
template<class T>auto lerp(const T& a, const T& b, bool t) -> T
-
template<std::auto lerp(const Vector<size, T>& a, const Vector<size, T>& b, const BitVector<size>& t) -> Vector<size, T>
size_t size, class T> -
template<std::auto lerp(const BitVector<size>& a, const BitVector<size>& b, const BitVector<size>& t) -> BitVector<size>
size_t size> -
template<class T>auto lerpInverted(T a, T b, T lerp) -> UnderlyingTypeOf<typename std::
enable_if<IsScalar<T>::value, T>::type> - Inverse linear interpolation of two values.
-
template<std::auto lerpInverted(const Vector<size, T>& a, const Vector<size, T>& b, const Vector<size, T>& lerp) -> Vector<size, UnderlyingTypeOf<T>>
size_t size, class T> -
template<class T, class U>auto select(const T& a, const T& b, U t) -> T constexpr
- Constant interpolation of two values.
-
template<class T>auto fma(T a, T b, T c) -> std::
enable_if<IsScalar<T>::value, T>::type - Fused multiply-add.
-
template<std::auto fma(const Vector<size, T>& a, const Vector<size, T>& b, const Vector<size, T>& c) -> Vector<size, T>
size_t size, class T>
Exponential and power functions
Unlike scalar/vector functions these don't work on Deg / Rad as the resulting unit can't be easily expressed.
- auto log(UnsignedInt base, UnsignedInt number) -> UnsignedInt
- Integral logarithm.
- auto log2(UnsignedInt number) -> UnsignedInt
- Base-2 integral logarithm.
-
template<class T>auto log(T number) -> T
- Natural logarithm.
-
template<class T>auto exp(T exponent) -> T
- Natural exponential.
-
template<UnsignedInt exponent, class T>auto pow(T base) -> std::
enable_if<IsScalar<T>::value, T>::type constexpr - Integral power.
-
template<UnsignedInt exponent, std::auto pow(const Vector<size, T>& base) -> Vector<size, T>
size_t size, class T> -
template<class T>auto pow(T base, T exponent) -> std::
enable_if<IsScalar<T>::value, T>::type - Power.
-
template<std::auto pow(const Vector<size, T>& base, T exponent) -> Vector<size, T>
size_t size, class T> -
template<class T>auto sqrt(T a) -> std::
enable_if<IsScalar<T>::value, T>::type - Square root.
-
template<std::auto sqrt(const Vector<size, T>& a) -> Vector<size, T>
size_t size, class T> -
template<class T>auto sqrtInverted(T a) -> std::
enable_if<IsScalar<T>::value, T>::type - Inverse square root.
-
template<std::auto sqrtInverted(const Vector<size, T>& a) -> Vector<size, T>
size_t size, class T>
Batch functions
These functions process an ubounded range of values, as opposed to single vectors or scalars.
-
template<class T>auto isInf(const Containers::
StridedArrayView1D<const T>& range) -> auto - If any number in the range is a positive or negative infinity.
-
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::auto isInf(Iterable&& range) -> auto new in 2020.06
declval<Iterable && >()))> -
template<class T>auto isInf(std::
initializer_list<T> list) -> auto -
template<class T, std::auto isInf(const T(&array)[size]) -> auto
size_t size> -
template<class T>auto isNan(const Containers::
StridedArrayView1D<const T>& range) -> auto - If any number in the range is a NaN.
-
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::auto isNan(Iterable&& range) -> auto new in 2020.06
declval<Iterable && >()))> -
template<class T>auto isNan(std::
initializer_list<T> list) -> auto -
template<class T, std::auto isNan(const T(&array)[size]) -> auto
size_t size> -
template<class T>auto min(const Containers::
StridedArrayView1D<const T>& range) -> T - Minimum of a range.
-
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::auto min(Iterable&& range) -> T new in 2020.06
declval<Iterable && >()))> -
template<class T>auto min(std::
initializer_list<T> list) -> T -
template<class T, std::auto min(const T(&array)[size]) -> T
size_t size> -
template<class T>auto max(const Containers::
StridedArrayView1D<const T>& range) -> T - Maximum of a range.
-
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::auto max(Iterable&& range) -> T new in 2020.06
declval<Iterable && >()))> -
template<class T>auto max(std::
initializer_list<T> list) -> T -
template<class T, std::auto max(const T(&array)[size]) -> T
size_t size> -
template<class T>auto minmax(const Containers::
StridedArrayView1D<const T>& range) -> Containers:: Pair<T, T> - Minimum and maximum of a range.
-
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::auto minmax(Iterable&& range) -> Containers::
declval<Iterable && >()))> Pair<T, T> new in 2020.06 -
template<class T>auto minmax(std::
initializer_list<T> list) -> Containers:: Pair<T, T> -
template<class T, std::auto minmax(const T(&array)[size]) -> Containers::
size_t size> Pair<T, T>
Packing and unpacking functions
Similarly to scalar/vector functions these work on both scalars and vectors, including Deg and Rad.
-
template<class FloatingPoint, class Integral>auto unpack(const Integral& value) -> FloatingPoint
- Unpack integral value into a floating-point representation.
-
template<class FloatingPoint, class Integral, UnsignedInt bits>auto unpack(const Integral& value) -> FloatingPoint
- Unpack integer bits into a floating-point representation.
-
template<class Integral, class FloatingPoint>auto pack(const FloatingPoint& value) -> Integral
- Pack floating-point value into an integer representation.
-
template<class Integral, UnsignedInt bits, class FloatingPoint>auto pack(FloatingPoint value) -> Integral
- Pack floating-point value into integer bits.
- auto packHalf(Float value) -> UnsignedShort
- Pack 32-bit float value into 16-bit half-float representation.
-
template<std::auto packHalf(const Vector<size, Float>& value) -> Vector<size, UnsignedShort>
size_t size> - auto unpackHalf(UnsignedShort value) -> Float
- Unpack 16-bit half-float value into 32-bit float representation.
-
template<std::auto unpackHalf(const Vector<size, UnsignedShort>& value) -> Vector<size, Float>
size_t size>
Batch packing functions
These functions process an ubounded range of values, as opposed to single vectors or scalars.
-
void unpackInto(const Containers::
StridedArrayView2D<const UnsignedByte>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 - Unpack unsigned integral values into a floating-point representation.
-
void unpackInto(const Containers::
StridedArrayView2D<const UnsignedShort>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 -
void unpackInto(const Containers::
StridedArrayView2D<const Byte>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 - Unpack signed integral values into a floating-point representation.
-
void unpackInto(const Containers::
StridedArrayView2D<const Short>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 -
void packInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in 2020.06 - Pack floating-point values into an integer representation.
-
void packInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<Byte>& dst) new in 2020.06 -
void packInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in 2020.06 -
void packInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<Short>& dst) new in 2020.06 -
void packHalfInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in 2020.06 - Pack 32-bit float values into 16-bit half-float representation.
-
void unpackHalfInto(const Containers::
StridedArrayView2D<const UnsignedShort>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 - Unpack a range of 16-bit half-float values into 32-bit float representation.
-
void castInto(const Containers::
StridedArrayView2D<const UnsignedByte>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 - Cast integer values into a 32-bit floating-point representation.
-
void castInto(const Containers::
StridedArrayView2D<const Byte>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const UnsignedShort>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Short>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const UnsignedInt>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Int>& src, const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const UnsignedByte>& src, const Containers:: StridedArrayView2D<Double>& dst) new in Git master - Cast integer values into a 64-bit floating-point representation.
-
void castInto(const Containers::
StridedArrayView2D<const Byte>& src, const Containers:: StridedArrayView2D<Double>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedShort>& src, const Containers:: StridedArrayView2D<Double>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Short>& src, const Containers:: StridedArrayView2D<Double>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedInt>& src, const Containers:: StridedArrayView2D<Double>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Int>& src, const Containers:: StridedArrayView2D<Double>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in 2020.06 - Cast 32-bit floating-point values into an integer representation.
-
void castInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<Byte>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<Short>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<Int>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Double>& src, const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in Git master - Cast 64-bit floating-point values into an integer representation.
-
void castInto(const Containers::
StridedArrayView2D<const Double>& src, const Containers:: StridedArrayView2D<Byte>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Double>& src, const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Double>& src, const Containers:: StridedArrayView2D<Short>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Double>& src, const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Double>& src, const Containers:: StridedArrayView2D<Int>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedByte>& src, const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in Git master - Cast integer values into a differently sized type.
-
void castInto(const Containers::
StridedArrayView2D<const Byte>& src, const Containers:: StridedArrayView2D<Short>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedByte>& src, const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Byte>& src, const Containers:: StridedArrayView2D<Int>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const UnsignedShort>& src, const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Short>& src, const Containers:: StridedArrayView2D<Int>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const UnsignedByte>& src, const Containers:: StridedArrayView2D<UnsignedLong>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Byte>& src, const Containers:: StridedArrayView2D<Long>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedShort>& src, const Containers:: StridedArrayView2D<UnsignedLong>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Short>& src, const Containers:: StridedArrayView2D<Long>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedInt>& src, const Containers:: StridedArrayView2D<UnsignedLong>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Int>& src, const Containers:: StridedArrayView2D<Long>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedLong>& src, const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Long>& src, const Containers:: StridedArrayView2D<Int>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedLong>& src, const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Long>& src, const Containers:: StridedArrayView2D<Short>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedLong>& src, const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Long>& src, const Containers:: StridedArrayView2D<Byte>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedInt>& src, const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Int>& src, const Containers:: StridedArrayView2D<Short>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const UnsignedInt>& src, const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const Int>& src, const Containers:: StridedArrayView2D<Byte>& dst) new in 2020.06 -
void castInto(const Containers::
StridedArrayView2D<const UnsignedShort>& src, const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Short>& src, const Containers:: StridedArrayView2D<Byte>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<Double>& dst) new in Git master - Cast 32-bit floating-point values into a 64-bit floating-point representation.
-
void castInto(const Containers::
StridedArrayView2D<const Double>& src, const Containers:: StridedArrayView2D<Float>& dst) new in Git master - Cast 64-bit floating-point values into a 32-bit floating-point representation.
-
void castInto(const Containers::
StridedArrayView2D<const UnsignedByte>& src, const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in Git master - Copy values.
-
void castInto(const Containers::
StridedArrayView2D<const Byte>& src, const Containers:: StridedArrayView2D<Byte>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedShort>& src, const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Short>& src, const Containers:: StridedArrayView2D<Short>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedInt>& src, const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Int>& src, const Containers:: StridedArrayView2D<Int>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const UnsignedLong>& src, const Containers:: StridedArrayView2D<UnsignedLong>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Long>& src, const Containers:: StridedArrayView2D<Long>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Float>& src, const Containers:: StridedArrayView2D<Float>& dst) new in Git master -
void castInto(const Containers::
StridedArrayView2D<const Double>& src, const Containers:: StridedArrayView2D<Double>& dst) new in Git master
Typedef documentation
#include <Magnum/Math/Bezier.h>
template<UnsignedInt dimensions, class T>
using Magnum:: Math:: QuadraticBezier = Bezier<2, dimensions, T>
Quadratic Bézier curve.
Convenience alternative to Bezier<2, dimensions, T>
. See Bezier for more information.
#include <Magnum/Math/Bezier.h>
template<class T>
using Magnum:: Math:: QuadraticBezier2D = QuadraticBezier<2, T>
Two-dimensional quadratic Bézier curve.
Convenience alternative to QuadraticBezier<2, T>
. See QuadraticBezier and Bezier for more information.
#include <Magnum/Math/Bezier.h>
template<class T>
using Magnum:: Math:: QuadraticBezier3D = QuadraticBezier<3, T>
Three-dimensional quadratic Bézier curve.
Convenience alternative to QuadraticBezier<3, T>
. See QuadraticBezier and Bezier for more information.
#include <Magnum/Math/Bezier.h>
template<UnsignedInt dimensions, class T>
using Magnum:: Math:: CubicBezier = Bezier<3, dimensions, T>
Cubic Bézier curve.
Convenience alternative to Bezier<3, dimensions, T>
. See Bezier for more information.
#include <Magnum/Math/Bezier.h>
template<class T>
using Magnum:: Math:: CubicBezier2D = CubicBezier<2, T>
Two-dimensional cubic Bézier curve.
Convenience alternative to CubicBezier<2, T>
. See CubicBezier and Bezier for more information.
#include <Magnum/Math/Bezier.h>
template<class T>
using Magnum:: Math:: CubicBezier3D = CubicBezier<3, T>
Three-dimensional cubic Bézier curve.
Convenience alternative to CubicBezier<3, T>
. See CubicBezier and Bezier for more information.
#include <Magnum/Math/BoolVector.h>
template<std:: size_t size>
using Magnum:: Math:: BoolVector = BitVector<size>
Vector of bits.
#include <Magnum/Math/CubicHermite.h>
template<class T>
using Magnum:: Math:: CubicHermite1D = CubicHermite<T>
Scalar cubic Hermite spline point.
Convenience alternative to CubicHermite<T>
. See CubicHermite for more information.
#include <Magnum/Math/CubicHermite.h>
template<class T>
using Magnum:: Math:: CubicHermite2D = CubicHermite<Vector2<T>>
Two-dimensional cubic Hermite spline point.
Convenience alternative to CubicHermite<Vector2<T>>
. See CubicHermite for more information.
#include <Magnum/Math/CubicHermite.h>
template<class T>
using Magnum:: Math:: CubicHermite3D = CubicHermite<Vector3<T>>
Three-dimensional cubic Hermite spline point.
Convenience alternative to CubicHermite<Vector2<T>>
. See CubicHermite for more information.
#include <Magnum/Math/CubicHermite.h>
template<class T>
using Magnum:: Math:: CubicHermiteComplex = CubicHermite<Complex<T>>
Cubic Hermite spline complex number.
Convenience alternative to CubicHermite<Complex<T>>
. See CubicHermite for more information.
#include <Magnum/Math/CubicHermite.h>
template<class T>
using Magnum:: Math:: CubicHermiteQuaternion = CubicHermite<Quaternion<T>>
Cubic Hermite spline quaternion.
Convenience alternative to CubicHermite<Quaternion<T>>
. See CubicHermite for more information.
#include <Magnum/Math/Matrix.h>
template<class T>
using Magnum:: Math:: Matrix2x2 = Matrix<2, T>
2x2 matrix
Convenience alternative to Matrix<2, T>
. See Matrix for more information.
#include <Magnum/Math/Matrix.h>
template<class T>
using Magnum:: Math:: Matrix3x3 = Matrix<3, T>
3x3 matrix
Convenience alternative to Matrix<3, T>
. See Matrix for more information. Note that this is different from Matrix3, which contains additional functions for transformations in 2D.
#include <Magnum/Math/Matrix.h>
template<class T>
using Magnum:: Math:: Matrix4x4 = Matrix<4, T>
4x4 matrix
Convenience alternative to Matrix<4, T>
. See Matrix for more information. Note that this is different from Matrix4, which contains additional functions for transformations in 3D.
#include <Magnum/Math/Range.h>
template<class T>
using Magnum:: Math:: Range1D = Range<1, T>
One-dimensional range.
Convenience alternative to Range<1, T>
. See Range for more information.
#include <Magnum/Math/RectangularMatrix.h>
template<class T>
using Magnum:: Math:: Matrix2x1 = RectangularMatrix<2, 1, T> new in Git master
Matrix with 2 columns and 1 row.
Convenience alternative to RectangularMatrix<2, 1, T>
. See RectangularMatrix for more information. There's no 1-column 2-row matrix typedef, use Vector2 instead.
#include <Magnum/Math/RectangularMatrix.h>
template<class T>
using Magnum:: Math:: Matrix2x3 = RectangularMatrix<2, 3, T>
Matrix with 2 columns and 3 rows.
Convenience alternative to RectangularMatrix<2, 3, T>
. See RectangularMatrix for more information.
#include <Magnum/Math/RectangularMatrix.h>
template<class T>
using Magnum:: Math:: Matrix2x4 = RectangularMatrix<2, 4, T>
Matrix with 2 columns and 4 rows.
Convenience alternative to RectangularMatrix<2, 4, T>
. See RectangularMatrix for more information.
#include <Magnum/Math/RectangularMatrix.h>
template<class T>
using Magnum:: Math:: Matrix3x1 = RectangularMatrix<3, 1, T> new in Git master
Matrix with 3 columns and 1 row.
Convenience alternative to RectangularMatrix<3, 1, T>
. See RectangularMatrix for more information. There's no 1-column 3-row matrix typedef, use Vector3 instead.
#include <Magnum/Math/RectangularMatrix.h>
template<class T>
using Magnum:: Math:: Matrix3x2 = RectangularMatrix<3, 2, T>
Matrix with 3 columns and 2 rows.
Convenience alternative to RectangularMatrix<3, 2, T>
. See RectangularMatrix for more information.
#include <Magnum/Math/RectangularMatrix.h>
template<class T>
using Magnum:: Math:: Matrix3x4 = RectangularMatrix<3, 4, T>
Matrix with 3 columns and 4 rows.
Convenience alternative to RectangularMatrix<3, 4, T>
. See RectangularMatrix for more information.
#include <Magnum/Math/RectangularMatrix.h>
template<class T>
using Magnum:: Math:: Matrix4x1 = RectangularMatrix<4, 1, T> new in Git master
Matrix with 4 columns and 1 row.
Convenience alternative to RectangularMatrix<4, 1, T>
. See RectangularMatrix for more information. There's no 1-column 4-row matrix typedef, use Vector4 instead.
#include <Magnum/Math/RectangularMatrix.h>
template<class T>
using Magnum:: Math:: Matrix4x2 = RectangularMatrix<4, 2, T>
Matrix with 4 columns and 2 rows.
Convenience alternative to RectangularMatrix<4, 2, T>
. See RectangularMatrix for more information.
#include <Magnum/Math/RectangularMatrix.h>
template<class T>
using Magnum:: Math:: Matrix4x3 = RectangularMatrix<4, 3, T>
Matrix with 4 columns and 3 rows.
Convenience alternative to RectangularMatrix<4, 3, T>
. See RectangularMatrix for more information.
typedef Magnum:: NoInitT Magnum:: Math:: NoInitT
#include <Magnum/Math/Tags.h>
No initialization tag type.
#include <Magnum/Math/TypeTraits.h>
template<class T>
using Magnum:: Math:: UnderlyingTypeOf = typename Implementation::UnderlyingType<T>::Type new in 2019.10
Underlying type of a math type.
For builtin scalar types returns the type itself, for wrapped types like Deg or Rad returns the underlying builtin type, for vector and matrix types the type of their components.
For scalar types it's guaranteed that the input type is always explicitly convertible to the output type and the output type is usable with standard APIs such as std::
Function documentation
#include <Magnum/Math/Angle.h>
template<class T>
Utility:: Debug& Magnum:: Math:: operator<<(Utility:: Debug& debug,
const Unit<Rad, T>& value)
Debug output operator.
#include <Magnum/Math/Angle.h>
template<class T>
Utility:: Debug& Magnum:: Math:: operator<<(Utility:: Debug& debug,
const Unit<Deg, T>& value)
Debug output operator.
#include <Magnum/Math/Bezier.h>
template<UnsignedInt order, UnsignedInt dimensions, class T>
Utility:: Debug& Magnum:: Math:: operator<<(Debug& debug,
const Bezier<order, dimensions, T>& value)
Debug output operator.
#include <Magnum/Math/BitVector.h>
template<std:: size_t size>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const BitVector<size>& value) new in Git master
Debug output operator.
In order to avoid potential confusion, prints the value as a comma-separated sequence of binary literals, so the output corresponds to how the value would be constructed. For example,
Debug{} << BitVector4{0b1010} << Math::BitVector<19>{0b00001000, 0b00000011, 0b100};
prints as
BitVector(0b1010) BitVector(0b00001000, 0b00000011, 0b100)
Note that this, on the other hand, makes mapping to bit indices less obvious — see Bit indexing for more information.
#include <Magnum/Math/Color.h>
template<class T>
Vector3<T> Magnum:: Math:: xyYToXyz(const Vector3<T>& xyY)
Convert color from CIE xyY representation to CIE XYZ.
#include <Magnum/Math/Color.h>
template<class T>
Vector3<T> Magnum:: Math:: xyzToXyY(const Vector3<T>& xyz)
Convert color from CIE XYZ representation to CIE xyY
#include <Magnum/Math/Color.h>
template<class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const ColorHsv<T>& value)
Debug output operator.
Debug& Magnum:: Math:: operator<<(Debug& debug,
const Color3<UnsignedByte>& value)
#include <Magnum/Math/Color.h>
Debug output operator.
If Debug::░▒▓█
shades, however the color is set for both foreground and background so the actual block character is indistinguishable when seen on a terminal.
If Debug::
If Debug::#ff33aa
). Other underlying types are handled by operator<<(Debug&, const Vector<size, T>&).
For example, the following snippet:
Debug{Debug::Flag::Color} << 0xdcdcdc_rgb << 0xa5c9ea_rgb << 0x3bd267_rgb << 0xc7cf2f_rgb << 0xcd3431_rgb << 0x2f83cc_rgb << 0x747474_rgb;
prints the following on terminals that support it:
██ ██ ██ ██ ██ ▓▓ ▒▒
Debug& Magnum:: Math:: operator<<(Debug& debug,
const Color4<UnsignedByte>& value)
#include <Magnum/Math/Color.h>
Debug output operator.
If Debug::░▒▓█
shades. The square shade is calculated as a product of Color4::
If Debug::
If Debug::#ff33aaff
). Other underlying types are handled by operator<<(Debug&, const Vector<size, T>&).
For example, the following snippet:
Debug{Debug::Flag::Color} << 0x3bd26700_rgba << 0x3bd26733_rgba << 0x3bd26766_rgba << 0x3bd26799_rgba << 0x3bd267cc_rgba << 0x3bd267ff_rgba;
prints the following on terminals that support it:
░░ ▒▒ ▓▓ ██
void Magnum:: Math:: yFlipBc1InPlace(const Containers:: StridedArrayView4D<char>& blocks) new in Git master
#include <Magnum/Math/ColorBatch.h>
Y-flip BC1 texture blocks in-place.
Performs a Y flip of given 3D image by flipping block order and modifying internal block representation to encode the same information, just upside down. No decoding or re-encoding of the block data is performed, thus the operation is lossless. However note that this operation flips full blocks — if size of the actual image isn't whole blocks, the flipped image will be shifted compared to the original, possibly with garbage data appearing in the first few rows.
First dimension is expected to be image slices, second block rows, third 2D blocks, fourth the 64-bit 4x4 block data, i.e. the last dimension is expected to be contiguous with size of 8.
void Magnum:: Math:: yFlipBc2InPlace(const Containers:: StridedArrayView4D<char>& blocks) new in Git master
#include <Magnum/Math/ColorBatch.h>
Y-flip BC2 texture blocks in-place.
Performs a Y flip of given 3D image by flipping block order and modifying internal block representation to encode the same information, just upside down. No decoding or re-encoding of the block data is performed, thus the operation is lossless. However note that this operation flips full blocks — if size of the actual image isn't whole blocks, the flipped image will be shifted compared to the original, possibly with garbage data appearing in the first few rows.
First dimension is expected to be image slices, second block rows, third 2D blocks, fourth the 128-bit 4x4 block data, i.e. the last dimension is expected to be contiguous with size of 16.
void Magnum:: Math:: yFlipBc3InPlace(const Containers:: StridedArrayView4D<char>& blocks) new in Git master
#include <Magnum/Math/ColorBatch.h>
Y-flip BC3 texture blocks in-place.
Performs a Y flip of given 3D image by flipping block order and modifying internal block representation to encode the same information, just upside down. No decoding or re-encoding of the block data is performed, thus the operation is lossless. However note that this operation flips full blocks — if size of the actual image isn't whole blocks, the flipped image will be shifted compared to the original, possibly with garbage data appearing in the first few rows.
First dimension is expected to be image slices, second block rows, third 2D blocks, fourth the 128-bit 4x4 block data, i.e. the last dimension is expected to be contiguous with size of 16. As BC3 is internally a 64-bit BC4 block for alpha followed by a 64-bit BC1 block for RGB, the operation is the same as performing yFlipBc4InPlace() on the first half and yFlipBc1InPlace() on second half of each block.
void Magnum:: Math:: yFlipBc4InPlace(const Containers:: StridedArrayView4D<char>& blocks) new in Git master
#include <Magnum/Math/ColorBatch.h>
Y-flip BC4 texture blocks in-place.
Performs a Y flip of given 3D image by flipping block order and modifying internal block representation to encode the same information, just upside down. No decoding or re-encoding of the block data is performed, thus the operation is lossless. However note that this operation flips full blocks — if size of the actual image isn't whole blocks, the flipped image will be shifted compared to the original, possibly with garbage data appearing in the first few rows.
First dimension is expected to be image slices, second block rows, third 2D blocks, fourth the 64-bit 4x4 block data, i.e. the last dimension is expected to be contiguous with size of 8.
void Magnum:: Math:: yFlipBc5InPlace(const Containers:: StridedArrayView4D<char>& blocks) new in Git master
#include <Magnum/Math/ColorBatch.h>
Y-flip BC5 texture blocks in-place.
Performs a Y flip of given 3D image by flipping block order and modifying internal block representation to encode the same information, just upside down. No decoding or re-encoding of the block data is performed, thus the operation is lossless. However note that this operation flips full blocks — if size of the actual image isn't whole blocks, the flipped image will be shifted compared to the original, possibly with garbage data appearing in the first few rows.
First dimension is expected to be image slices, second block rows, third 2D blocks, fourth the 128-bit 4x4 block data, i.e. the last dimension is expected to be contiguous with size of 16. As BC5 is internally two 64-bit BC4 blocks, the operation is the same as performing yFlipBc4InPlace() on both halves of each block.
#include <Magnum/Math/Complex.h>
template<class T>
T Magnum:: Math:: dot(const Complex<T>& a,
const Complex<T>& b)
Dot product of two complex numbers.
#include <Magnum/Math/Complex.h>
template<class T>
Rad<T> Magnum:: Math:: angle(const Complex<T>& normalizedA,
const Complex<T>& normalizedB)
Angle between normalized complex numbers.
Expects that both complex numbers are normalized.
To avoid numerical issues when two complex numbers are very close to each other, the dot product is clamped to the range before being passed to .
#include <Magnum/Math/Complex.h>
template<class T>
Complex<T> Magnum:: Math:: operator*(const Vector2<T>& vector,
const Complex<T>& complex)
Multiply a vector with a complex number.
#include <Magnum/Math/Complex.h>
template<class T>
Complex<T> Magnum:: Math:: lerp(const Complex<T>& normalizedA,
const Complex<T>& normalizedB,
T t)
Linear interpolation of two complex numbers.
Parameters | |
---|---|
normalizedA | First complex number |
normalizedB | Second complex number |
t | Interpolation phase (from range ) |
Expects that both complex numbers are normalized.
#include <Magnum/Math/Complex.h>
template<class T>
Complex<T> Magnum:: Math:: slerp(const Complex<T>& normalizedA,
const Complex<T>& normalizedB,
T t)
Spherical linear interpolation of two complex numbers.
Parameters | |
---|---|
normalizedA | First complex number |
normalizedB | Second complex number |
t | Interpolation phase (from range ) |
Expects that both complex numbers are normalized. If the complex numbers are the same, returns the first argument.
#include <Magnum/Math/Complex.h>
template<class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const Complex<T>& value)
Debug output operator.
#include <Magnum/Math/CubicHermite.h>
template<class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const CubicHermite<T>& value)
Debug output operator.
#include <Magnum/Math/CubicHermite.h>
template<class T, class U>
T Magnum:: Math:: select(const CubicHermite<T>& a,
const CubicHermite<T>& b,
U t)
Constant interpolation of two cubic Hermite spline points.
Parameters | |
---|---|
a | First spline point |
b | Second spline point |
t | Interpolation phase (from range ) |
Given segment points , in-tangents and out-tangents , the interpolated value at phase is:
Equivalent to calling select(const T&, const T&, U) on CubicHermite::a
and b
.
#include <Magnum/Math/CubicHermite.h>
template<class T, class U>
T Magnum:: Math:: lerp(const CubicHermite<T>& a,
const CubicHermite<T>& b,
U t)
Linear interpolation of two cubic Hermite points.
Parameters | |
---|---|
a | First spline point |
b | Second spline point |
t | Interpolation phase (from range ) |
Given segment points , in-tangents and out-tangents , the interpolated value at phase is:
Equivalent to calling lerp(const T&, const T&, U) on CubicHermite::a
and b
.
#include <Magnum/Math/CubicHermite.h>
template<class T>
Complex<T> Magnum:: Math:: lerp(const CubicHermiteComplex<T>& a,
const CubicHermiteComplex<T>& b,
T t)
Linear interpolation of two cubic Hermite complex numbers.
Equivalent to calling lerp(const Complex<T>&, const Complex<T>&, T) on CubicHermite::a
and b
. Compared to lerp(const CubicHermite<T>&, const CubicHermite<T>&, U) this adds a normalization step after. Expects that CubicHermite::a
and b
.
#include <Magnum/Math/CubicHermite.h>
template<class T>
Quaternion<T> Magnum:: Math:: lerp(const CubicHermiteQuaternion<T>& a,
const CubicHermiteQuaternion<T>& b,
T t)
Linear interpolation of two cubic Hermite quaternions.
Equivalent to calling lerp(const Quaternion<T>&, const Quaternion<T>&, T) on CubicHermite::a
and b
. Compared to lerp(const CubicHermite<T>&, const CubicHermite<T>&, U) this adds a normalization step after. Expects that CubicHermite::a
and b
.
#include <Magnum/Math/CubicHermite.h>
template<class T>
Quaternion<T> Magnum:: Math:: lerpShortestPath(const CubicHermiteQuaternion<T>& a,
const CubicHermiteQuaternion<T>& b,
T t)
Linear shortest-path interpolation of two cubic Hermite quaternions.
Equivalent to calling lerpShortestPath(const Quaternion<T>&, const Quaternion<T>&, T) on CubicHermite::a
and b
. Expects that CubicHermite::a
and b
.
Note that rotations interpolated with this function may go along a completely different path compared to splerp(const CubicHermiteQuaternion<T>&, const CubicHermiteQuaternion<T>&, T). Use lerp(const CubicHermiteQuaternion<T>&, const CubicHermiteQuaternion<T>&, T) for behavior that is consistent with spline interpolation.
#include <Magnum/Math/CubicHermite.h>
template<class T>
Complex<T> Magnum:: Math:: slerp(const CubicHermiteComplex<T>& a,
const CubicHermiteComplex<T>& b,
T t)
Spherical linear interpolation of two cubic Hermite complex numbers.
Equivalent to calling slerp(const Complex<T>&, const Complex<T>&, T) on CubicHermite::a
and b
. Expects that CubicHermite::a
and b
.
#include <Magnum/Math/CubicHermite.h>
template<class T>
Quaternion<T> Magnum:: Math:: slerp(const CubicHermiteQuaternion<T>& a,
const CubicHermiteQuaternion<T>& b,
T t)
Spherical linear interpolation of two cubic Hermite quaternions.
Equivalent to calling slerp(const Quaternion<T>&, const Quaternion<T>&, T) on CubicHermite::a
and b
. Expects that CubicHermite::a
and b
.
#include <Magnum/Math/CubicHermite.h>
template<class T>
Quaternion<T> Magnum:: Math:: slerpShortestPath(const CubicHermiteQuaternion<T>& a,
const CubicHermiteQuaternion<T>& b,
T t)
Spherical linear shortest-path interpolation of two cubic Hermite quaternions.
Equivalent to calling slerpShortestPath(const Quaternion<T>&, const Quaternion<T>&, T) on CubicHermite::a
and b
. Expects that CubicHermite::a
and b
.
Note that rotations interpolated with this function may go along a completely different path compared to splerp(const CubicHermiteQuaternion<T>&, const CubicHermiteQuaternion<T>&, T). Use slerp(const CubicHermiteQuaternion<T>&, const CubicHermiteQuaternion<T>&, T) for spherical linear interpolation with behavior that is consistent with spline interpolation.
#include <Magnum/Math/CubicHermite.h>
template<class T, class U>
T Magnum:: Math:: splerp(const CubicHermite<T>& a,
const CubicHermite<T>& b,
U t)
Spline interpolation of two cubic Hermite points.
Parameters | |
---|---|
a | First spline point |
b | Second spline point |
t | Interpolation phase |
Given segment points , in-tangents and out-tangents , the interpolated value at phase is:
#include <Magnum/Math/CubicHermite.h>
template<class T>
Complex<T> Magnum:: Math:: splerp(const CubicHermiteComplex<T>& a,
const CubicHermiteComplex<T>& b,
T t)
Spline interpolation of two cubic Hermite complex numbers.
Unlike splerp(const CubicHermite<T>&, const CubicHermite<T>&, U) this adds a normalization step after. Given segment points , in-tangents and out-tangents , the interpolated value at phase is:
Expects that CubicHermite::a
and b
.
#include <Magnum/Math/CubicHermite.h>
template<class T>
Quaternion<T> Magnum:: Math:: splerp(const CubicHermiteQuaternion<T>& a,
const CubicHermiteQuaternion<T>& b,
T t)
Spline interpolation of two cubic Hermite quaternions.
Unlike splerp(const CubicHermite<T>&, const CubicHermite<T>&, U) this adds a normalization step after. Given segment points , in-tangents and out-tangents , the interpolated value at phase is:
Expects that CubicHermite::a
and b
.
#include <Magnum/Math/Dual.h>
template<class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const Dual<T>& value)
Debug output operator.
#include <Magnum/Math/Dual.h>
template<class T>
Dual<T> Magnum:: Math:: sqrt(const Dual<T>& dual)
Square root of dual number.
#include <Magnum/Math/Dual.h>
template<class T>
Containers:: Pair<Dual<T>, Dual<T>> Magnum:: Math:: sincos(const Dual<Rad<T>>& angle)
Sine and cosine of dual angle.
#include <Magnum/Math/DualComplex.h>
template<class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const DualComplex<T>& value)
Debug output operator.
#include <Magnum/Math/DualQuaternion.h>
template<class T>
DualQuaternion<T> Magnum:: Math:: sclerp(const DualQuaternion<T>& normalizedA,
const DualQuaternion<T>& normalizedB,
const T t)
Screw linear interpolation of two dual quaternions.
Parameters | |
---|---|
normalizedA | First dual quaternion |
normalizedB | Second dual quaternion |
t | Interpolation phase (from range ) |
Expects that both dual quaternions are normalized. If the real parts are the same or one is a negation of the other, returns the DualQuaternion::
otherwise, the interpolation is performed as:
Note that this function does not check for shortest path interpolation, see sclerpShortestPath() for an alternative.
#include <Magnum/Math/DualQuaternion.h>
template<class T>
DualQuaternion<T> Magnum:: Math:: sclerpShortestPath(const DualQuaternion<T>& normalizedA,
const DualQuaternion<T>& normalizedB,
const T t)
Screw linear shortest-path interpolation of two dual quaternions.
Parameters | |
---|---|
normalizedA | First dual quaternion |
normalizedB | Second dual quaternion |
t | Interpolation phase (from range ) |
Unlike sclerp(const DualQuaternion<T>&, const DualQuaternion<T>&, T) this function interpolates on the shortest path. Expects that both dual quaternions are normalized. If the real parts are the same or one is a negation of the other, returns the DualQuaternion::
otherwise, the interpolation is performed as:
#include <Magnum/Math/DualQuaternion.h>
template<class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const DualQuaternion<T>& value)
Debug output operator.
#include <Magnum/Math/Frustum.h>
template<class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const Frustum<T>& value)
Debug output operator.
#include <Magnum/Math/Functions.h>
template<class Integral>
Containers:: Pair<Integral, Integral> Magnum:: Math:: div(Integral x,
Integral y)
Integer division with remainder.
Example usage:
Containers::Pair<Int, Int> quotientRemainder = Math::div(57, 6); // {9, 3}
Equivalent to the following, but possibly done in a single CPU instruction:
Int quotient = 57/6; Int remainder = 57%6;
UnsignedLong Magnum:: Math:: binomialCoefficient(UnsignedInt n,
UnsignedInt k) new in Git master
#include <Magnum/Math/Functions.h>
Returns the number of combinations of things taken at a time, with :
UnsignedInt Magnum:: Math:: popcount(UnsignedInt number) new in Git master
#include <Magnum/Math/Functions.h>
Count of bits set in a number.
Expands to __builtin_popcount
/ __builtin_popcountll
on GCC and Clang, uses the Counting bits set, in parallel implementation from Sean Eron Anderson Bit Twiddling Hacks page on MSVC and elsewhere.
See also Containers::
UnsignedInt Magnum:: Math:: popcount(UnsignedLong number) new in Git master
#include <Magnum/Math/Functions.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: reflect(const Vector<size, T>& vector,
const Vector<size, T>& normal) new in 2020.06
Reflect a vector.
Reflects the vector off a surface given the surface outward normal. Expects that the normal vector is normalized. For a vector and a normal , the reflection vector is calculated as:
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: refract(const Vector<size, T>& vector,
const Vector<size, T>& normal,
T eta) new in 2020.06
Refract a vector.
Refracts a vector through a medium given the surface outward normal and ratio of indices of refraction eta. Expects that both vector
and normal
is normalized. For a vector , normal and a ratio of indices of refraction , the refraction vector is calculated as:
Wikipedia has a List of refractive indices.
Debug& Magnum:: Math:: operator<<(Debug& debug,
Half value)
#include <Magnum/Math/Half.h>
Debug output operator.
Prints the value with 4 significant digits.
#include <Magnum/Math/Quaternion.h>
template<class T>
T Magnum:: Math:: dot(const Quaternion<T>& a,
const Quaternion<T>& b)
Dot product between two quaternions.
#include <Magnum/Math/Quaternion.h>
template<class T>
Rad<T> Magnum:: Math:: halfAngle(const Quaternion<T>& normalizedA,
const Quaternion<T>& normalizedB)
Half-angle between normalized quaternions.
Expects that both quaternions are normalized.
To avoid numerical issues when two complex numbers are very close to each other, the dot product is clamped to the range before being passed to .
#include <Magnum/Math/Quaternion.h>
template<class T>
Rad<T> Magnum:: Math:: angle(const Quaternion<T>& normalizedA,
const Quaternion<T>& normalizedB)
Half-angle between normalized quaternions.
#include <Magnum/Math/Quaternion.h>
template<class T>
Quaternion<T> Magnum:: Math:: lerp(const Quaternion<T>& normalizedA,
const Quaternion<T>& normalizedB,
T t)
Linear interpolation of two quaternions.
Parameters | |
---|---|
normalizedA | First quaternion |
normalizedB | Second quaternion |
t | Interpolation phase (from range ) |
Expects that both quaternions are normalized.
Note that this function does not check for shortest path interpolation, see lerpShortestPath(const Quaternion<T>&, const Quaternion<T>&, T) for an alternative.
#include <Magnum/Math/Quaternion.h>
template<class T>
Quaternion<T> Magnum:: Math:: lerpShortestPath(const Quaternion<T>& normalizedA,
const Quaternion<T>& normalizedB,
T t)
Linear shortest-path interpolation of two quaternions.
Parameters | |
---|---|
normalizedA | First quaternion |
normalizedB | Second quaternion |
t | Interpolation phase (from range ) |
Unlike lerp(const Quaternion<T>&, const Quaternion<T>&, T), this interpolates on the shortest path at some performance expense. Expects that both quaternions are normalized.
#include <Magnum/Math/Quaternion.h>
template<class T>
Quaternion<T> Magnum:: Math:: slerp(const Quaternion<T>& normalizedA,
const Quaternion<T>& normalizedB,
T t)
Spherical linear interpolation of two quaternions.
Parameters | |
---|---|
normalizedA | First quaternion |
normalizedB | Second quaternion |
t | Interpolation phase (from range ) |
Expects that both quaternions are normalized. If the quaternions are nearly the same or one is a negation of the other, it falls back to a linear interpolation (shortest-path to avoid a degenerate case of returning a zero quaternion for ), but without post-normalization as the interpolation result can still be considered sufficiently normalized:
Otherwise, the interpolation is performed as:
Note that this function does not check for shortest path interpolation, see slerpShortestPath(const Quaternion<T>&, const Quaternion<T>&, T) for an alternative.
#include <Magnum/Math/Quaternion.h>
template<class T>
Quaternion<T> Magnum:: Math:: slerpShortestPath(const Quaternion<T>& normalizedA,
const Quaternion<T>& normalizedB,
T t)
Spherical linear shortest-path interpolation of two quaternions.
Parameters | |
---|---|
normalizedA | First quaternion |
normalizedB | Second quaternion |
t | Interpolation phase (from range ) |
Unlike slerp(const Quaternion<T>&, const Quaternion<T>&, T) this function interpolates on the shortest path. Expects that both quaternions are normalized. If the quaternions are nearly the same or one is a negation of the other, it falls back to a linear interpolation (shortest-path to avoid a degenerate case of returning a zero quaternion for ) but without post-normalization as the interpolation result can still be considered sufficiently normalized:
Otherwise, the interpolation is performed as:
#include <Magnum/Math/Quaternion.h>
template<class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const Quaternion<T>& value)
Debug output operator.
#include <Magnum/Math/Range.h>
template<UnsignedInt dimensions, class T>
Range<dimensions, T> Magnum:: Math:: join(const Range<dimensions, T>& a,
const Range<dimensions, T>& b)
Join two ranges.
Returns a range that contains both input ranges. If one of the ranges is empty, only the other is returned. Results are undefined if any range has a negative size.
#include <Magnum/Math/Range.h>
template<UnsignedInt dimensions, class T>
Range<dimensions, T> Magnum:: Math:: join(const Range<dimensions, T>& a,
const Vector<dimensions, T>& b) new in Git master
Join a range and a point.
Returns a range that contains both the input range and the point. Compared to join(const Range<dimensions, T>&, const Range<dimensions, T>&) there's no special casing for an empty range. Results are undefined if the range has a negative size.
#include <Magnum/Math/Range.h>
template<UnsignedInt dimensions, class T>
Range<dimensions, T> Magnum:: Math:: intersect(const Range<dimensions, T>& a,
const Range<dimensions, T>& b)
Intersect two ranges.
Returns a range that covers the intersection of both ranges. If the intersection is empty, a default-constructed range is returned. The range minimum is interpreted as inclusive, maximum as exclusive. Results are undefined if any range has a negative size.
#include <Magnum/Math/Range.h>
template<UnsignedInt dimensions, class T>
bool Magnum:: Math:: intersects(const Range<dimensions, T>& a,
const Range<dimensions, T>& b)
Whether two ranges intersect.
Returns true
if the following holds for all dimensions , false
otherwise.
The range minimum is interpreted as inclusive, maximum as exclusive. Results are undefined if any range has a negative size.
#include <Magnum/Math/Range.h>
template<UnsignedInt dimensions, class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const Range<dimensions, T>& value)
Debug output operator.
#include <Magnum/Math/RectangularMatrix.h>
template<std:: size_t cols, std:: size_t rows, class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const Magnum:: Math:: RectangularMatrix<cols, rows, T>& value)
Debug output operator.
#include <Magnum/Math/Swizzle.h>
template<char ... components, class T>
Implementation::TypeForSize<sizeof...(components), T>::Type Magnum:: Math:: gather(const T& vector) constexpr new in 2019.10
Gather Vector components.
Creates a new vector from given components. Example:
Vector4i original(-1, 2, 3, 4); auto vec = Math::gather<'w', '1', '0', 'x', 'y', 'z'>(original); // vec == { 4, 1, 0, -1, 2, 3 }
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. Alternatively you can also address components using their numeric index — which is especially useful when your input has more than four components. Count of elements is unlimited, but must be at least one. If the resulting vector is two, three or four-component, corresponding Vector2, Vector3, Vector4, Color3 or Color4 specialization is returned.
#include <Magnum/Math/Swizzle.h>
template<char ... components, class T>
T Magnum:: Math:: scatter(const T& vector,
const Vector<sizeof...(components), typename T::Type>& values) constexpr new in 2019.10
Scatter Vector components.
Parameters | |
---|---|
vector | Vector to update |
values | Values to update it with |
Returns | Updated vector |
Returns a copy of vector
with particular components updated from values
. Inverse to gather(), supporting the same component addressing except for '0'
and '1'
. Example:
Vector4 vec{1.5f, 3.0f, 0.1f, 1.1f}; Vector2 coords{5.0f, -2.0f}; vec = Math::scatter<'z', 'w'>(vec, coords); // { 1.5, 3.0, 5.0, -2.0 } /* Combine the two for more advanced swizzles */ Vector4 vec2; vec2 = Math::scatter<'w', 'x', 'y'>(vec2, Math::gather<'x', 'w', 'y'>(vec));
Utility:: Debug& Magnum:: Math:: operator<<(Utility:: Debug& debug,
const Unit<Nanoseconds, Long>& value) new in Git master
#include <Magnum/Math/Time.h>
Debug output operator.
Utility:: Debug& Magnum:: Math:: operator<<(Utility:: Debug& debug,
const Unit<Seconds, Float>& value) new in Git master
#include <Magnum/Math/Time.h>
Debug output operator.
#include <Magnum/Math/TypeTraits.h>
template<class T>
std:: enable_if<IsScalar<T>::value, bool>::type Magnum:: Math:: equal(T a,
T b) new in 2019.10
Equality comparison of scalar types.
Calls TypeTraits<T>::
#include <Magnum/Math/TypeTraits.h>
template<class T>
std:: enable_if<IsScalar<T>::value, bool>::type Magnum:: Math:: notEqual(T a,
T b) new in 2019.10
Non-equality comparison of scalar types.
Calls TypeTraits<T>::
#include <Magnum/Math/Vector.h>
template<std:: size_t size, class T>
T Magnum:: Math:: dot(const Vector<size, T>& a,
const Vector<size, T>& b)
Dot product of two vectors.
Returns 0
when two vectors are perpendicular, > 0
when two vectors are in the same general direction, 1
when two normalized vectors are parallel, < 0
when two vectors are in opposite general direction and -1
when two normalized vectors are antiparallel.
#include <Magnum/Math/Vector.h>
template<std:: size_t size, class FloatingPoint>
Rad<FloatingPoint> Magnum:: Math:: angle(const Vector<size, FloatingPoint>& normalizedA,
const Vector<size, FloatingPoint>& normalizedB)
Angle between normalized vectors.
Expects that both vectors are normalized. Enabled only for floating-point types.
To avoid numerical issues when two vectors are very close to each other, the dot product is clamped to the range before being passed to .
#include <Magnum/Math/Vector.h>
template<std:: size_t size, class T>
BitVector<size> Magnum:: Math:: equal(const Vector<size, T>& a,
const Vector<size, T>& b) new in 2019.10
Component-wise equality comparison.
Unlike Vector::
#include <Magnum/Math/Vector.h>
template<std:: size_t size, class T>
BitVector<size> Magnum:: Math:: notEqual(const Vector<size, T>& a,
const Vector<size, T>& b) new in 2019.10
Component-wise non-equality comparison.
Unlike Vector::
#include <Magnum/Math/Vector.h>
template<std:: size_t size, class T>
Debug& Magnum:: Math:: operator<<(Debug& debug,
const Vector<size, T>& value)
Debug output operator.
#include <Magnum/Math/Vector2.h>
template<class T>
T Magnum:: Math:: cross(const Vector2<T>& a,
const Vector2<T>& b)
2D cross product
2D version of a cross product, also called a perp-dot product, equivalent to calling cross(const Vector3<T>&, const Vector3<T>&) with Z coordinate set to 0
and extracting only Z coordinate from the result (X and Y coordinates are always zero). Returns 0
either when one of the vectors is zero or they are parallel or antiparallel and 1
when two normalized vectors are perpendicular.
If , and are corners of a triangle, is its area. Value of a 2D cross product is also related to a distance of a point and a line, see Distance::
#include <Magnum/Math/Vector3.h>
template<class T>
Vector3<T> Magnum:: Math:: cross(const Vector3<T>& a,
const Vector3<T>& b)
Result has length of 0
either when one of them is zero or they are parallel or antiparallel and length of 1
when two normalized vectors are perpendicular.
If , and are corners of a triangle in a counterclockwise order, gives the direction of its normal, and is its area. Length of a cross product is also related to a distance of a point and a line, see Distance::
#include <Magnum/Math/Vector4.h>
template<class T>
Vector4<T> Magnum:: Math:: planeEquation(const Vector3<T>& p0,
const Vector3<T>& p1,
const Vector3<T>& p2)
Create a plane equation from three points.
Assuming the three points form a triangle in a counter-clockwise winding, creates a plane equation in the following form:
The first three coefficients describe the scaled normal and are calculated using a cross product. The coefficient is calculated using a dot product with the normal using the first point in order to satisfy the equation when assigning to , , .
#include <Magnum/Math/Vector4.h>
template<class T>
Vector4<T> Magnum:: Math:: planeEquation(const Vector3<T>& normal,
const Vector3<T>& point)
Create a plane equation from a normal and a point.
Creates a plane equation in the following form:
The first three coefficients describe the scaled normal , the coefficient is calculated using a dot product with the normal using the point in order to satisfy the equation when assigning to , , .
#include <Magnum/Math/Functions.h>
template<class T>
T Magnum:: Math:: sin(Rad<T> angle)
Sine.
#include <Magnum/Math/Functions.h>
template<class T>
T Magnum:: Math:: cos(Rad<T> angle)
Cosine.
#include <Magnum/Math/Functions.h>
template<class T>
Containers:: Pair<T, T> Magnum:: Math:: sincos(Rad<T> angle)
Sine and cosine.
On GCC, this uses the __builtin_sincos
intrinsic (or its f
/ l
suffixed variants), which may be faster than calculating sine and cosine separately. On other compilers this might result in the optimizer picking up the combined instruction as well.
#include <Magnum/Math/Functions.h>
template<class T>
T Magnum:: Math:: tan(Rad<T> angle)
Tangent.
#include <Magnum/Math/Functions.h>
template<class T>
Rad<T> Magnum:: Math:: asin(T value)
Arc sine.
#include <Magnum/Math/Functions.h>
template<class T>
Rad<T> Magnum:: Math:: acos(T value)
Arc cosine.
#include <Magnum/Math/Functions.h>
template<class T>
Rad<T> Magnum:: Math:: atan(T value)
Arc tangent.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, bool>::type Magnum:: Math:: isInf(T value) new in 2019.10
If given number is a positive or negative infinity.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
BitVector<size> Magnum:: Math:: isInf(const Vector<size, T>& value) new in 2019.10
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, bool>::type Magnum:: Math:: isNan(T value) new in 2019.10
If given number is a NaN.
Equivalent to value != value
.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
BitVector<size> Magnum:: Math:: isNan(const Vector<size, T>& value) new in 2019.10
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: min(T value,
T min) constexpr
Minimum.
NaNs passed in the value
parameter are propagated.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: min(const Vector<size, T>& value,
const Vector<size, T>& min)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: min(const Vector<size, T>& value,
T min)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: max(T a,
T b) constexpr
Maximum.
NaNs passed in the value
parameter are propagated.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: max(const Vector<size, T>& value,
const Vector<size, T>& max)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: max(const Vector<size, T>& value,
T max)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, Containers:: Pair<T, T>>::type Magnum:: Math:: minmax(T a,
T b)
Minimum and maximum of two values.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Containers:: Pair<Vector<size, T>, Vector<size, T>> Magnum:: Math:: minmax(const Vector<size, T>& a,
const Vector<size, T>& b)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: clamp(T value,
T min,
T max) constexpr
Clamp value.
Values smaller than min
are set to min
, values larger than max
are set to max
. Equivalent to:
Math::min(Math::max(value, min), max)
NaNs passed in value
parameter are propagated.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: clamp(const Vector<size, T>& value,
const Vector<size, T>& min,
const Vector<size, T>& max)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: clamp(const Vector<size, T>& value,
T min,
T max)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, UnderlyingTypeOf<T>>::type Magnum:: Math:: sign(T scalar)
Sign.
Returns 1
if x
> 0, 0
if x
= 0 and -1
if x
< 0.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, UnderlyingTypeOf<T>> Magnum:: Math:: sign(const Vector<size, T>& a)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: abs(T a)
Absolute value.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: abs(const Vector<size, T>& a)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: floor(T a)
Nearest not larger integer.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: floor(const Vector<size, T>& a)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: round(T a)
Round value to nearest integer.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: round(const Vector<size, T>& a)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: ceil(T a)
Nearest not smaller integer.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: ceil(const Vector<size, T>& a)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: fmod(T a,
T b) new in Git master
Floating point division remainder.
Parameters | |
---|---|
a | Numerator |
b | Denumerator |
Calculates the remainder of a floating point division:
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: fmod(const Vector<size, T>& a,
const Vector<size, T>& b) new in Git master
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: fmod(const Vector<size, T>& a,
T b) new in Git master
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T, class U>
T Magnum:: Math:: lerp(const T& a,
const T& b,
U t)
Linear interpolation of two values.
Parameters | |
---|---|
a | First value |
b | Second value |
t | Interpolation phase (from range ) |
The interpolation for vectors is done as in following, similarly for scalars:
See select() for constant interpolation using the same API and splerp() for spline interpolation.
#include <Magnum/Math/Functions.h>
template<class T>
T Magnum:: Math:: lerp(const T& a,
const T& b,
bool t)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: lerp(const Vector<size, T>& a,
const Vector<size, T>& b,
const BitVector<size>& t)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Similar to the above, but instead of multiplication and addition it just does component-wise selection from either a
or b
based on values in t
.
#include <Magnum/Math/Functions.h>
template<std:: size_t size>
BitVector<size> Magnum:: Math:: lerp(const BitVector<size>& a,
const BitVector<size>& b,
const BitVector<size>& t)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
UnderlyingTypeOf<typename std:: enable_if<IsScalar<T>::value, T>::type> Magnum:: Math:: lerpInverted(T a,
T b,
T lerp)
Inverse linear interpolation of two values.
Parameters | |
---|---|
a | First value |
b | Second value |
lerp | Interpolated value |
Returns interpolation phase t:
Useful in combination with lerp() for mapping values from one range to another — for example, the following snippet maps a
from a range to a range ; the second expression combines that with clamp() to ensure the value is in bounds:
Deg b = Math::lerp(5.0_degf, 15.0_degf, Math::lerpInverted(-1.0f, 1.0f, a)); Deg bClamped = Math::lerp(5.0_degf, 15.0_degf, Math::clamp( Math::lerpInverted(-1.0f, 1.0f, a), 0.0f, 1.0f));
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, UnderlyingTypeOf<T>> Magnum:: Math:: lerpInverted(const Vector<size, T>& a,
const Vector<size, T>& b,
const Vector<size, T>& lerp)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T, class U>
T Magnum:: Math:: select(const T& a,
const T& b,
U t) constexpr
Constant interpolation of two values.
Parameters | |
---|---|
a | First value |
b | Second value |
t | Interpolation phase |
A constant interpolation counterpart to lerp():
Equivalent to calling Math::lerp(a, b, t >= U(1))
.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: fma(T a,
T b,
T c)
Fused multiply-add.
Computes and returns . On some architectures might be faster than doing the computation manually. Works only on types that satisfy IsUnitless.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: fma(const Vector<size, T>& a,
const Vector<size, T>& b,
const Vector<size, T>& c)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
UnsignedInt Magnum:: Math:: log(UnsignedInt base,
UnsignedInt number)
#include <Magnum/Math/Functions.h>
Integral logarithm.
Returns integral logarithm of given number with given base.
UnsignedInt Magnum:: Math:: log2(UnsignedInt number)
#include <Magnum/Math/Functions.h>
Base-2 integral logarithm.
Returns integral logarithm of given number with base 2
.
#include <Magnum/Math/Functions.h>
template<class T>
T Magnum:: Math:: log(T number)
Natural logarithm.
Returns natural (base ) logarithm of given number.
#include <Magnum/Math/Functions.h>
template<class T>
T Magnum:: Math:: exp(T exponent)
Natural exponential.
Returns .
#include <Magnum/Math/Functions.h>
template<UnsignedInt exponent, class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: pow(T base) constexpr
Integral power.
Returns integral power of base to the exponent. Works only on types that satisfy IsUnitless.
#include <Magnum/Math/Functions.h>
template<UnsignedInt exponent, std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: pow(const Vector<size, T>& base)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: pow(T base,
T exponent)
Power.
Returns power of base
to the exponent
. Works only on types that satisfy IsUnitless.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: pow(const Vector<size, T>& base,
T exponent)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: sqrt(T a)
Square root.
Works only on types that satisfy IsUnitless.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: sqrt(const Vector<size, T>& a)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Functions.h>
template<class T>
std:: enable_if<IsScalar<T>::value, T>::type Magnum:: Math:: sqrtInverted(T a)
Inverse square root.
Works only on types that satisfy IsUnitless.
#include <Magnum/Math/Functions.h>
template<std:: size_t size, class T>
Vector<size, T> Magnum:: Math:: sqrtInverted(const Vector<size, T>& a)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
auto Magnum:: Math:: isInf(const Containers:: StridedArrayView1D<const T>& range)
If any number in the range is a positive or negative infinity.
For scalar types returns true
as soon as it finds an infinite value, false
otherwise. For vector types, returns BitVector with bits set to 1
if any value has that component infinite. If the range is empty, returns false
or a BitVector with no bits set.
#include <Magnum/Math/FunctionsBatch.h>
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std:: declval<Iterable && >()))>
auto Magnum:: Math:: isInf(Iterable&& range) new in 2020.06
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Converts range
to Containers::
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
auto Magnum:: Math:: isInf(std:: initializer_list<T> list)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T, std:: size_t size>
auto Magnum:: Math:: isInf(const T(&array)[size])
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
auto Magnum:: Math:: isNan(const Containers:: StridedArrayView1D<const T>& range)
If any number in the range is a NaN.
For scalar types returns true
as soon as it finds a NaN value, false
otherwise. For vector types, returns BitVector with bits set to 1
if any value has that component NaN. If the range is empty, returns false
or a BitVector with no bits set.
#include <Magnum/Math/FunctionsBatch.h>
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std:: declval<Iterable && >()))>
auto Magnum:: Math:: isNan(Iterable&& range) new in 2020.06
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Converts range
to Containers::
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
auto Magnum:: Math:: isNan(std:: initializer_list<T> list)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T, std:: size_t size>
auto Magnum:: Math:: isNan(const T(&array)[size])
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
T Magnum:: Math:: min(const Containers:: StridedArrayView1D<const T>& range)
Minimum of a range.
If the range is empty, returns default-constructed value. NaNs are ignored, unless the range is all NaNs.
#include <Magnum/Math/FunctionsBatch.h>
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std:: declval<Iterable && >()))>
T Magnum:: Math:: min(Iterable&& range) new in 2020.06
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Converts range
to Containers::
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
T Magnum:: Math:: min(std:: initializer_list<T> list)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T, std:: size_t size>
T Magnum:: Math:: min(const T(&array)[size])
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
T Magnum:: Math:: max(const Containers:: StridedArrayView1D<const T>& range)
Maximum of a range.
If the range is empty, returns default-constructed value. NaNs are ignored, unless the range is all NaNs.
#include <Magnum/Math/FunctionsBatch.h>
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std:: declval<Iterable && >()))>
T Magnum:: Math:: max(Iterable&& range) new in 2020.06
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Converts range
to Containers::
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
T Magnum:: Math:: max(std:: initializer_list<T> list)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T, std:: size_t size>
T Magnum:: Math:: max(const T(&array)[size])
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
Containers:: Pair<T, T> Magnum:: Math:: minmax(const Containers:: StridedArrayView1D<const T>& range)
Minimum and maximum of a range.
If the range is empty, returns default-constructed values. NaNs are ignored, unless the range is all NaNs.
#include <Magnum/Math/FunctionsBatch.h>
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std:: declval<Iterable && >()))>
Containers:: Pair<T, T> Magnum:: Math:: minmax(Iterable&& range) new in 2020.06
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Converts range
to Containers::
#include <Magnum/Math/FunctionsBatch.h>
template<class T>
Containers:: Pair<T, T> Magnum:: Math:: minmax(std:: initializer_list<T> list)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/FunctionsBatch.h>
template<class T, std:: size_t size>
Containers:: Pair<T, T> Magnum:: Math:: minmax(const T(&array)[size])
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Packing.h>
template<class FloatingPoint, class Integral>
FloatingPoint Magnum:: Math:: unpack(const Integral& value)
Unpack integral value into a floating-point representation.
Converts integral value from full range of given unsigned integral type to value in range or from signed integral to range .
#include <Magnum/Math/Packing.h>
template<class FloatingPoint, class Integral, UnsignedInt bits>
FloatingPoint Magnum:: Math:: unpack(const Integral& value)
Unpack integer bits into a floating-point representation.
Alternative to the above with ability to specify how many bits of the integral representation to use. Example usage:
Float a = Math::unpack<Float, UnsignedShort>(8191); // 0.124987f Float b = Math::unpack<Float, UnsignedShort, 14>(8191); // 0.499969f Float c = Math::unpack<Float, 14>(8191u); // 0.499969f Float d = Math::unpack<Float, 14>(8191); // 1.0f
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
#include <Magnum/Math/Packing.h>
template<class Integral, class FloatingPoint>
Integral Magnum:: Math:: pack(const FloatingPoint& value)
Pack floating-point value into an integer representation.
Converts floating-point value in range to full range of given unsigned integral type or range to full range of given signed integral type.
#include <Magnum/Math/Packing.h>
template<class Integral, UnsignedInt bits, class FloatingPoint>
Integral Magnum:: Math:: pack(FloatingPoint value)
Pack floating-point value into integer bits.
Alternative to the above with ability to specify how many bits of the integral representation to use. Example usage:
auto a = Math::pack<UnsignedShort>(0.5f); // 32767 auto b = Math::pack<UnsignedShort, 14>(0.5f); // 8191
UnsignedShort Magnum:: Math:: packHalf(Float value)
#include <Magnum/Math/Packing.h>
Pack 32-bit float value into 16-bit half-float representation.
See Wikipedia for more information about half floats. NaNs are converted to NaNs and infinities to infinities, though their exact bit pattern is not preserved. Note that rounding mode is unspecified in order to save some cycles.
Implementation based on CC0 / public domain code by Fabian Giesen, https:/
#include <Magnum/Math/Packing.h>
template<std:: size_t size>
Vector<size, UnsignedShort> Magnum:: Math:: packHalf(const Vector<size, Float>& value)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Float Magnum:: Math:: unpackHalf(UnsignedShort value)
#include <Magnum/Math/Packing.h>
Unpack 16-bit half-float value into 32-bit float representation.
See Wikipedia for more information about half floats. NaNs are converted to NaNs and infinities to infinities, though their exact bit pattern is not preserved.
Implementation based on CC0 / public domain code by Fabian Giesen, https:/
#include <Magnum/Math/Packing.h>
template<std:: size_t size>
Vector<size, Float> Magnum:: Math:: unpackHalf(const Vector<size, UnsignedShort>& value)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: unpackInto(const Containers:: StridedArrayView2D<const UnsignedByte>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
Unpack unsigned integral values into a floating-point representation.
Parameters | |
---|---|
src in | Source integral values |
dst out | Destination floating-point values |
Converts integral values from full range of given unsigned integral type to floating-point values in range . Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: unpackInto(const Containers:: StridedArrayView2D<const UnsignedShort>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: unpackInto(const Containers:: StridedArrayView2D<const Byte>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
Unpack signed integral values into a floating-point representation.
Parameters | |
---|---|
src in | Source integral values |
dst out | Destination floating-point values |
Converts integral values from full range of given signed integral type to floating-point values in range . Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: unpackInto(const Containers:: StridedArrayView2D<const Short>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: packInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
Pack floating-point values into an integer representation.
Parameters | |
---|---|
src in | Source floating-point values |
dst out | Destination integral values |
Converts floating-point value in range to full range of given unsigned integral type or range to full range of given signed integral type. Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: packInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<Byte>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: packInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: packInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<Short>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: packHalfInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
Pack 32-bit float values into 16-bit half-float representation.
Parameters | |
---|---|
src in | Source 32-bit float values |
dst out | Destination 16-bit half-float values |
See Wikipedia for more information about half floats. Unlike packHalf() this function is a faster table-based implementation at the expense of using more memory, thus more suitable for batch conversions of large data amounts. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
Algorithm used: Jeroen van der Zijp – Fast Half Float Conversions, 2008, ftp:/
void Magnum:: Math:: unpackHalfInto(const Containers:: StridedArrayView2D<const UnsignedShort>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
Unpack a range of 16-bit half-float values into 32-bit float representation.
Parameters | |
---|---|
src in | Source floating-point values |
dst out | Destination integral values |
See Wikipedia for more information about half floats. Unlike unpackHalf() this function is a faster table-based implementation at the expense of using more memory, thus more suitable for batch conversions of large data amounts. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
Algorithm used: Jeroen van der Zijp – Fast Half Float Conversions, 2008, ftp:/
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedByte>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
Cast integer values into a 32-bit floating-point representation.
Parameters | |
---|---|
src in | Source integral values |
dst out | Destination float values |
Unlike packInto(), this function performs only an equivalent of Float(a)
over the range, so e.g. 135
becomes 135.0f
. Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Byte>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedShort>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Short>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedInt>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Int>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedByte>& src,
const Containers:: StridedArrayView2D<Double>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
Cast integer values into a 64-bit floating-point representation.
Parameters | |
---|---|
src in | Source integral values |
dst out | Destination float values |
Unlike packInto(), this function performs only an equivalent of Double(a)
over the range, so e.g. 135
becomes 135.0
. Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Byte>& src,
const Containers:: StridedArrayView2D<Double>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedShort>& src,
const Containers:: StridedArrayView2D<Double>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Short>& src,
const Containers:: StridedArrayView2D<Double>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedInt>& src,
const Containers:: StridedArrayView2D<Double>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Int>& src,
const Containers:: StridedArrayView2D<Double>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
Cast 32-bit floating-point values into an integer representation.
Parameters | |
---|---|
src in | Source float values |
dst out | Destination integral values |
Unlike packInto(), this function performs only an equivalent of T(a)
over the range, so e.g. 135.0f
becomes 135
. Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<Byte>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<Short>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<Int>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Double>& src,
const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
Cast 64-bit floating-point values into an integer representation.
Parameters | |
---|---|
src in | Source double values |
dst out | Destination integral values |
Unlike packInto(), this function performs only an equivalent of T(a)
over the range, so e.g. 135.0
becomes 135
. Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Double>& src,
const Containers:: StridedArrayView2D<Byte>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Double>& src,
const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Double>& src,
const Containers:: StridedArrayView2D<Short>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Double>& src,
const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Double>& src,
const Containers:: StridedArrayView2D<Int>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedByte>& src,
const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
Cast integer values into a differently sized type.
Parameters | |
---|---|
src in | Source values |
dst out | Destination values |
Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Byte>& src,
const Containers:: StridedArrayView2D<Short>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedByte>& src,
const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Byte>& src,
const Containers:: StridedArrayView2D<Int>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedShort>& src,
const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Short>& src,
const Containers:: StridedArrayView2D<Int>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedByte>& src,
const Containers:: StridedArrayView2D<UnsignedLong>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Byte>& src,
const Containers:: StridedArrayView2D<Long>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedShort>& src,
const Containers:: StridedArrayView2D<UnsignedLong>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Short>& src,
const Containers:: StridedArrayView2D<Long>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedInt>& src,
const Containers:: StridedArrayView2D<UnsignedLong>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Int>& src,
const Containers:: StridedArrayView2D<Long>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedLong>& src,
const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Long>& src,
const Containers:: StridedArrayView2D<Int>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedLong>& src,
const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Long>& src,
const Containers:: StridedArrayView2D<Short>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedLong>& src,
const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Long>& src,
const Containers:: StridedArrayView2D<Byte>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedInt>& src,
const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Int>& src,
const Containers:: StridedArrayView2D<Short>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedInt>& src,
const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Int>& src,
const Containers:: StridedArrayView2D<Byte>& dst) new in 2020.06
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedShort>& src,
const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Short>& src,
const Containers:: StridedArrayView2D<Byte>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<Double>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
Cast 32-bit floating-point values into a 64-bit floating-point representation.
Parameters | |
---|---|
src in | Source float values |
dst out | Destination double values |
This function performs an equivalent of Double(a)
over the range, so e.g. 135.0f
becomes 135.0
. Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Double>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
Cast 64-bit floating-point values into a 32-bit floating-point representation.
Parameters | |
---|---|
src in | Source double values |
dst out | Destination float values |
This function performs an equivalent of Float(a)
over the range, so e.g. 135.0
becomes 135.0f
. Second dimension is meant to contain vector/matrix components, or have a size of 1 for scalars. Expects that src
and dst
have the same size and that the second dimension in both is contiguous.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedByte>& src,
const Containers:: StridedArrayView2D<UnsignedByte>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
Copy values.
Parameters | |
---|---|
src in | Source values |
dst out | Destination values |
Provided for convenience when writing generic code, delegates to Utility::src
and dst
have the same size, for consistency with other castInto() expects also that the second dimension in both is contiguous even though it's not required by Utility::
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Byte>& src,
const Containers:: StridedArrayView2D<Byte>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedShort>& src,
const Containers:: StridedArrayView2D<UnsignedShort>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Short>& src,
const Containers:: StridedArrayView2D<Short>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedInt>& src,
const Containers:: StridedArrayView2D<UnsignedInt>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Int>& src,
const Containers:: StridedArrayView2D<Int>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const UnsignedLong>& src,
const Containers:: StridedArrayView2D<UnsignedLong>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Long>& src,
const Containers:: StridedArrayView2D<Long>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Float>& src,
const Containers:: StridedArrayView2D<Float>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Math:: castInto(const Containers:: StridedArrayView2D<const Double>& src,
const Containers:: StridedArrayView2D<Double>& dst) new in Git master
#include <Magnum/Math/PackingBatch.h>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Variable documentation
Magnum:: NoInitT Magnum:: Math:: NoInit constexpr
#include <Magnum/Math/Tags.h>
No initialization tag.
ZeroInitT Magnum:: Math:: ZeroInit constexpr
#include <Magnum/Math/Tags.h>
Zero initialization tag.
Use for construction with all elements set to zero.
IdentityInitT Magnum:: Math:: IdentityInit constexpr
#include <Magnum/Math/Tags.h>
Identity initialization tag.
Use for construction with transformation set to identity.