Browse Source

Math: stop wasting time with the explicit Corrade:: prefix.

I did this back in 2010 because it "felt like the right thing to do",
given that all of Magnum depended on Math and not vice versa. But,
strictly speaking, Math already uses typedefs from Magnum/Types.h so why
it couldn't also bring in the Corrade namespace, and the
Debug/Warning/Error names too. Having to type out Corrade:: in all these
was really just a waste of time, weird inconsistency in docs and an
extra roadblock for whoever might want to contribute anything there.
pull/168/head
Vladimír Vondruš 3 years ago
parent
commit
4825ed0608
  1. 2
      src/Magnum/Math/Algorithms/GaussJordan.h
  2. 2
      src/Magnum/Math/Algorithms/Svd.h
  3. 2
      src/Magnum/Math/Algorithms/Test/GaussJordanTest.cpp
  4. 2
      src/Magnum/Math/Algorithms/Test/GramSchmidtTest.cpp
  5. 2
      src/Magnum/Math/Algorithms/Test/QrTest.cpp
  6. 2
      src/Magnum/Math/Algorithms/Test/SvdTest.cpp
  7. 21
      src/Magnum/Math/Angle.h
  8. 38
      src/Magnum/Math/Bezier.h
  9. 16
      src/Magnum/Math/BitVector.h
  10. 20
      src/Magnum/Math/Color.cpp
  11. 60
      src/Magnum/Math/Color.h
  12. 11
      src/Magnum/Math/ColorBatch.h
  13. 14
      src/Magnum/Math/Complex.h
  14. 34
      src/Magnum/Math/CubicHermite.h
  15. 8
      src/Magnum/Math/Dual.h
  16. 20
      src/Magnum/Math/DualComplex.h
  17. 28
      src/Magnum/Math/DualQuaternion.h
  18. 18
      src/Magnum/Math/Frustum.h
  19. 4
      src/Magnum/Math/Functions.cpp
  20. 16
      src/Magnum/Math/Functions.h
  21. 88
      src/Magnum/Math/FunctionsBatch.h
  22. 2
      src/Magnum/Math/Half.cpp
  23. 9
      src/Magnum/Math/Half.h
  24. 2
      src/Magnum/Math/Intersection.h
  25. 4
      src/Magnum/Math/Matrix.h
  26. 8
      src/Magnum/Math/Matrix3.h
  27. 8
      src/Magnum/Math/Matrix4.h
  28. 152
      src/Magnum/Math/PackingBatch.cpp
  29. 174
      src/Magnum/Math/PackingBatch.h
  30. 18
      src/Magnum/Math/Quaternion.h
  31. 32
      src/Magnum/Math/Range.h
  32. 108
      src/Magnum/Math/RectangularMatrix.h
  33. 4
      src/Magnum/Math/Swizzle.h
  34. 24
      src/Magnum/Math/Test/AngleTest.cpp
  35. 6
      src/Magnum/Math/Test/BezierTest.cpp
  36. 6
      src/Magnum/Math/Test/BitVectorTest.cpp
  37. 12
      src/Magnum/Math/Test/ColorBatchTest.cpp
  38. 90
      src/Magnum/Math/Test/ColorTest.cpp
  39. 6
      src/Magnum/Math/Test/ComplexTest.cpp
  40. 36
      src/Magnum/Math/Test/ConfigurationValueTest.cpp
  41. 2
      src/Magnum/Math/Test/ConstantsTest.cpp
  42. 18
      src/Magnum/Math/Test/CubicHermiteTest.cpp
  43. 2
      src/Magnum/Math/Test/DistanceTest.cpp
  44. 6
      src/Magnum/Math/Test/DualComplexTest.cpp
  45. 6
      src/Magnum/Math/Test/DualQuaternionTest.cpp
  46. 6
      src/Magnum/Math/Test/DualTest.cpp
  47. 12
      src/Magnum/Math/Test/FrustumTest.cpp
  48. 18
      src/Magnum/Math/Test/FunctionsBatchTest.cpp
  49. 18
      src/Magnum/Math/Test/FunctionsBenchmark.cpp
  50. 2
      src/Magnum/Math/Test/FunctionsTest.cpp
  51. 38
      src/Magnum/Math/Test/HalfTest.cpp
  52. 2
      src/Magnum/Math/Test/InterpolationBenchmark.cpp
  53. 2
      src/Magnum/Math/Test/IntersectionBenchmark.cpp
  54. 2
      src/Magnum/Math/Test/IntersectionTest.cpp
  55. 2
      src/Magnum/Math/Test/Matrix3Test.cpp
  56. 4
      src/Magnum/Math/Test/Matrix4Test.cpp
  57. 2
      src/Magnum/Math/Test/MatrixBenchmark.cpp
  58. 2
      src/Magnum/Math/Test/MatrixTest.cpp
  59. 314
      src/Magnum/Math/Test/PackingBatchTest.cpp
  60. 2
      src/Magnum/Math/Test/PackingTest.cpp
  61. 24
      src/Magnum/Math/Test/QuaternionTest.cpp
  62. 14
      src/Magnum/Math/Test/RangeTest.cpp
  63. 6
      src/Magnum/Math/Test/RectangularMatrixTest.cpp
  64. 2
      src/Magnum/Math/Test/StrictWeakOrderingTest.cpp
  65. 2
      src/Magnum/Math/Test/SwizzleTest.cpp
  66. 3
      src/Magnum/Math/Test/TagsTest.cpp
  67. 44
      src/Magnum/Math/Test/TypeTraitsTest.cpp
  68. 5
      src/Magnum/Math/Test/UnitTest.cpp
  69. 2
      src/Magnum/Math/Test/Vector2Test.cpp
  70. 2
      src/Magnum/Math/Test/Vector3Test.cpp
  71. 2
      src/Magnum/Math/Test/Vector4Test.cpp
  72. 2
      src/Magnum/Math/Test/VectorBenchmark.cpp
  73. 10
      src/Magnum/Math/Test/VectorTest.cpp
  74. 6
      src/Magnum/Math/TypeTraits.h
  75. 51
      src/Magnum/Math/Vector.h
  76. 166
      src/Magnum/Math/instantiation.cpp

2
src/Magnum/Math/Algorithms/GaussJordan.h

@ -62,7 +62,7 @@ template<std::size_t size, std::size_t rows, class T> bool gaussJordanInPlaceTra
rowMax = row2;
/* Swap the rows */
using Corrade::Utility::swap;
using Utility::swap;
swap(a[row], a[rowMax]);
swap(t[row], t[rowMax]);

2
src/Magnum/Math/Algorithms/Svd.h

@ -255,7 +255,7 @@ template<std::size_t cols, std::size_t rows, class T> std::tuple<RectangularMatr
/* Exceeded iteration count, done */
} else if(iteration >= maxIterations-1) {
Corrade::Utility::Error() << "Magnum::Math::Algorithms::svd(): no convergence";
Error{} << "Magnum::Math::Algorithms::svd(): no convergence";
return std::make_tuple(RectangularMatrix<cols, rows, T>{}, Vector<cols, T>{}, Matrix<cols, T>{ZeroInit});
}

2
src/Magnum/Math/Algorithms/Test/GaussJordanTest.cpp

@ -29,7 +29,7 @@
namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace {
struct GaussJordanTest: Corrade::TestSuite::Tester {
struct GaussJordanTest: TestSuite::Tester {
explicit GaussJordanTest();
void test();

2
src/Magnum/Math/Algorithms/Test/GramSchmidtTest.cpp

@ -29,7 +29,7 @@
namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace {
struct GramSchmidtTest: Corrade::TestSuite::Tester {
struct GramSchmidtTest: TestSuite::Tester {
explicit GramSchmidtTest();
void orthogonalize();

2
src/Magnum/Math/Algorithms/Test/QrTest.cpp

@ -31,7 +31,7 @@
namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace {
struct QrTest: Corrade::TestSuite::Tester {
struct QrTest: TestSuite::Tester {
explicit QrTest();
void test();

2
src/Magnum/Math/Algorithms/Test/SvdTest.cpp

@ -30,7 +30,7 @@
namespace Magnum { namespace Math { namespace Algorithms { namespace Test { namespace {
struct SvdTest: Corrade::TestSuite::Tester {
struct SvdTest: TestSuite::Tester {
explicit SvdTest();
template<class T> void test();

21
src/Magnum/Math/Angle.h

@ -34,6 +34,7 @@
#endif
#include "Magnum/visibility.h"
#include "Magnum/Magnum.h"
#include "Magnum/Math/Constants.h"
#include "Magnum/Math/Math.h"
#include "Magnum/Math/Unit.h"
@ -230,25 +231,25 @@ template<class T> constexpr Rad<T>::Rad(Unit<Deg, T> value): Unit<Math::Rad, T>(
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{Rad} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Unit<Rad, T>& value) {
if(debug.immediateFlags() >= Corrade::Utility::Debug::Flag::Packed)
template<class T> Utility::Debug& operator<<(Utility::Debug& debug, const Unit<Rad, T>& value) {
if(debug.immediateFlags() >= Utility::Debug::Flag::Packed)
return debug << T(value);
return debug << "Rad(" << Corrade::Utility::Debug::nospace << T(value) << Corrade::Utility::Debug::nospace << ")";
return debug << "Rad(" << Utility::Debug::nospace << T(value) << Utility::Debug::nospace << ")";
}
/** @debugoperator{Deg} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Unit<Deg, T>& value) {
if(debug.immediateFlags() >= Corrade::Utility::Debug::Flag::Packed)
template<class T> Utility::Debug& operator<<(Utility::Debug& debug, const Unit<Deg, T>& value) {
if(debug.immediateFlags() >= Utility::Debug::Flag::Packed)
return debug << T(value);
return debug << "Deg(" << Corrade::Utility::Debug::nospace << T(value) << Corrade::Utility::Debug::nospace << ")";
return debug << "Deg(" << Utility::Debug::nospace << T(value) << Utility::Debug::nospace << ")";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Unit<Rad, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Unit<Deg, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Unit<Rad, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Unit<Deg, Double>&);
extern template MAGNUM_EXPORT Utility::Debug& operator<<(Utility::Debug&, const Unit<Rad, Float>&);
extern template MAGNUM_EXPORT Utility::Debug& operator<<(Utility::Debug&, const Unit<Deg, Float>&);
extern template MAGNUM_EXPORT Utility::Debug& operator<<(Utility::Debug&, const Unit<Rad, Double>&);
extern template MAGNUM_EXPORT Utility::Debug& operator<<(Utility::Debug&, const Unit<Deg, Double>&);
#endif
#endif

38
src/Magnum/Math/Bezier.h

@ -102,17 +102,17 @@ template<UnsignedInt order, UnsignedInt dimensions, class T> class Bezier {
*
* Equivalent to @ref Bezier(ZeroInitT).
*/
constexpr /*implicit*/ Bezier() noexcept: Bezier<order, dimensions, T>{typename Corrade::Containers::Implementation::GenerateSequence<order + 1>::Type{}, ZeroInit} {}
constexpr /*implicit*/ Bezier() noexcept: Bezier<order, dimensions, T>{typename Containers::Implementation::GenerateSequence<order + 1>::Type{}, ZeroInit} {}
/**
* @brief Construct a zero curve
*
* All control points are zero vectors.
*/
constexpr explicit Bezier(ZeroInitT) noexcept: Bezier<order, dimensions, T>{typename Corrade::Containers::Implementation::GenerateSequence<order + 1>::Type{}, ZeroInit} {}
constexpr explicit Bezier(ZeroInitT) noexcept: Bezier<order, dimensions, T>{typename Containers::Implementation::GenerateSequence<order + 1>::Type{}, ZeroInit} {}
/** @brief Construct Bézier without initializing the contents */
explicit Bezier(Magnum::NoInitT) noexcept: Bezier<order, dimensions, T>{typename Corrade::Containers::Implementation::GenerateSequence<order + 1>::Type{}, Magnum::NoInit} {}
explicit Bezier(Magnum::NoInitT) noexcept: Bezier<order, dimensions, T>{typename Containers::Implementation::GenerateSequence<order + 1>::Type{}, Magnum::NoInit} {}
/** @brief Construct Bézier curve with given array of control points */
template<typename... U> constexpr /*implicit*/ Bezier(const Vector<dimensions, T>& first, U... next) noexcept: _data{first, next...} {
@ -125,7 +125,7 @@ template<UnsignedInt order, UnsignedInt dimensions, class T> class Bezier {
* Performs only default casting on the values, no rounding or
* anything else.
*/
template<class U> constexpr explicit Bezier(const Bezier<order, dimensions, U>& other) noexcept: Bezier{typename Corrade::Containers::Implementation::GenerateSequence<order + 1>::Type{}, other} {}
template<class U> constexpr explicit Bezier(const Bezier<order, dimensions, U>& other) noexcept: Bezier{typename Containers::Implementation::GenerateSequence<order + 1>::Type{}, other} {}
/** @brief Construct Bézier curve from external representation */
template<class U, class V = decltype(Implementation::BezierConverter<order, dimensions, T, U>::from(std::declval<U>()))> constexpr explicit Bezier(const U& other) noexcept: Bezier<order, dimensions, T>{Implementation::BezierConverter<order, dimensions, T, U>::from(other)} {}
@ -207,11 +207,11 @@ template<UnsignedInt order, UnsignedInt dimensions, class T> class Bezier {
private:
/* Implementation for Bezier<order, dimensions, T>::Bezier(const Bezier<order, dimensions, U>&) */
template<class U, std::size_t ...sequence> constexpr explicit Bezier(Corrade::Containers::Implementation::Sequence<sequence...>, const Bezier<order, dimensions, U>& other) noexcept: _data{Vector<dimensions, T>(other._data[sequence])...} {}
template<class U, std::size_t ...sequence> constexpr explicit Bezier(Containers::Implementation::Sequence<sequence...>, const Bezier<order, dimensions, U>& other) noexcept: _data{Vector<dimensions, T>(other._data[sequence])...} {}
/* Implementation for Bezier<order, dimensions, T>::Bezier(ZeroInitT) and Bezier<order, dimensions, T>::Bezier(NoInitT) */
/* MSVC 2015 can't handle {} here */
template<class U, std::size_t ...sequence> constexpr explicit Bezier(Corrade::Containers::Implementation::Sequence<sequence...>, U): _data{Vector<dimensions, T>((static_cast<void>(sequence), U{typename U::Init{}}))...} {}
template<class U, std::size_t ...sequence> constexpr explicit Bezier(Containers::Implementation::Sequence<sequence...>, U): _data{Vector<dimensions, T>((static_cast<void>(sequence), U{typename U::Init{}}))...} {}
/* Calculates and returns all intermediate points generated when using De Casteljau's algorithm */
void calculateIntermediatePoints(Bezier<order, dimensions, T>(&iPoints)[order + 1], T t) const {
@ -300,27 +300,27 @@ template<class T> using CubicBezier3D = CubicBezier<3, T>;
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{Bezier} */
template<UnsignedInt order, UnsignedInt dimensions, class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Bezier<order, dimensions, T>& value) {
debug << "Bezier(" << Corrade::Utility::Debug::nospace;
template<UnsignedInt order, UnsignedInt dimensions, class T> Utility::Debug& operator<<(Debug& debug, const Bezier<order, dimensions, T>& value) {
debug << "Bezier(" << Debug::nospace;
for(UnsignedInt o = 0; o != order + 1; ++o) {
debug << (o ? ", {" : "{") << Corrade::Utility::Debug::nospace << value[o][0] << Corrade::Utility::Debug::nospace;
debug << (o ? ", {" : "{") << Debug::nospace << value[o][0] << Debug::nospace;
for(UnsignedInt i = 1; i != dimensions; ++i)
debug << "," << value[o][i] << Corrade::Utility::Debug::nospace;
debug << "}" << Corrade::Utility::Debug::nospace;
debug << "," << value[o][i] << Debug::nospace;
debug << "}" << Debug::nospace;
}
return debug << ")";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<2, 2, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<2, 3, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<3, 2, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<3, 3, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<2, 2, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<2, 3, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<3, 2, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<3, 3, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Bezier<2, 2, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Bezier<2, 3, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Bezier<3, 2, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Bezier<3, 3, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Bezier<2, 2, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Bezier<2, 3, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Bezier<3, 2, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Bezier<3, 3, Double>&);
#endif
#endif

16
src/Magnum/Math/BitVector.h

@ -36,7 +36,7 @@
#include <Corrade/Utility/Debug.h>
#endif
#include "Magnum/Types.h"
#include "Magnum/Magnum.h"
#include "Magnum/Math/Math.h"
#include "Magnum/Math/Tags.h"
@ -119,7 +119,7 @@ template<std::size_t size> class BitVector {
#ifdef DOXYGEN_GENERATING_OUTPUT
explicit BitVector(T value) noexcept;
#else
template<class T, class U = typename std::enable_if<std::is_same<bool, T>::value && size != 1, bool>::type> constexpr explicit BitVector(T value) noexcept: BitVector(typename Corrade::Containers::Implementation::GenerateSequence<DataSize>::Type{}, value ? FullSegmentMask : 0) {}
template<class T, class U = typename std::enable_if<std::is_same<bool, T>::value && size != 1, bool>::type> constexpr explicit BitVector(T value) noexcept: BitVector(typename Containers::Implementation::GenerateSequence<DataSize>::Type{}, value ? FullSegmentMask : 0) {}
#endif
/** @brief Construct a boolean vector from external representation */
@ -324,7 +324,7 @@ template<std::size_t size> class BitVector {
};
/* Implementation for Vector<size, T>::Vector(U) */
template<std::size_t ...sequence> constexpr explicit BitVector(Corrade::Containers::Implementation::Sequence<sequence...>, UnsignedByte value): _data{Implementation::repeat(value, sequence)...} {}
template<std::size_t ...sequence> constexpr explicit BitVector(Containers::Implementation::Sequence<sequence...>, UnsignedByte value): _data{Implementation::repeat(value, sequence)...} {}
UnsignedByte _data[DataSize];
};
@ -352,22 +352,22 @@ BitVector(0b1010) BitVector(0b00001000, 0b00000011, 0b100)
Note that this, on the other hand, makes mapping to bit indices less obvious
--- see @ref Math-BitVector-indexing for more information.
*/
template<std::size_t size> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const BitVector<size>& value) {
debug << "BitVector(0b" << Corrade::Utility::Debug::nospace;
template<std::size_t size> Debug& operator<<(Debug& debug, const BitVector<size>& value) {
debug << "BitVector(0b" << Debug::nospace;
/* Print the full bytes comma-separated */
for(std::size_t byte = 0; byte != BitVector<size>::DataSize - 1; ++byte) {
for(std::size_t i = 0; i != 8; ++i)
debug << (((value.data()[byte] >> (8 - i - 1)) & 1) ? "1" : "0")
<< Corrade::Utility::Debug::nospace;
debug << ", 0b" << Corrade::Utility::Debug::nospace;
<< Debug::nospace;
debug << ", 0b" << Debug::nospace;
}
/* Print the last (potentially) partial byte */
constexpr std::size_t suffixSize = size%8 ? size%8 : 8;
for(std::size_t i = 0; i != suffixSize; ++i)
debug << (((value.data()[size/8] >> (suffixSize - i - 1)) & 1) ? "1" : "0")
<< Corrade::Utility::Debug::nospace;
<< Debug::nospace;
return debug << ")";
}

20
src/Magnum/Math/Color.cpp

@ -37,9 +37,9 @@ namespace {
constexpr const char Hex[]{"0123456789abcdef"};
}
Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color3<UnsignedByte>& value) {
Debug& operator<<(Debug& debug, const Color3<UnsignedByte>& value) {
/* Print an actual colored square if requested */
if(debug.immediateFlags() & Corrade::Utility::Debug::Flag::Color) {
if(debug.immediateFlags() & Debug::Flag::Color) {
/* Pick a shade based on calculated lightness */
const Float valueValue = value.value();
const char* shade;
@ -50,15 +50,15 @@ Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color3
else shade = "██";
/* If ANSI colors are disabled, use just the shade */
if(debug.immediateFlags() & Corrade::Utility::Debug::Flag::DisableColors)
if(debug.immediateFlags() & Debug::Flag::DisableColors)
return debug << shade;
else {
debug << "\033[38;2;";
/* Disable space between values for everything after the initial
value */
const Corrade::Utility::Debug::Flags previousFlags = debug.flags();
debug.setFlags(previousFlags|Corrade::Utility::Debug::Flag::NoSpace);
const Debug::Flags previousFlags = debug.flags();
debug.setFlags(previousFlags|Debug::Flag::NoSpace);
/* Set both background and foreground, reset back after */
debug << int(value.r()) << ";" << int(value.g()) << ";"
@ -83,9 +83,9 @@ Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color3
}
}
Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color4<UnsignedByte>& value) {
Debug& operator<<(Debug& debug, const Color4<UnsignedByte>& value) {
/* Print an actual colored square if requested */
if(debug.immediateFlags() & Corrade::Utility::Debug::Flag::Color) {
if(debug.immediateFlags() & Debug::Flag::Color) {
/* Pick a shade based on calculated lightness */
const Float valueValue = value.value();
const Float alpha = Math::unpack<Float>(value.a());
@ -98,15 +98,15 @@ Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color4
else shade = "██";
/* If ANSI colors are disabled, use just the shade */
if(debug.immediateFlags() & Corrade::Utility::Debug::Flag::DisableColors)
if(debug.immediateFlags() & Debug::Flag::DisableColors)
return debug << shade;
else {
debug << "\033[38;2;";
/* Disable space between values for everything after the initial
value */
const Corrade::Utility::Debug::Flags previousFlags = debug.flags();
debug.setFlags(previousFlags|Corrade::Utility::Debug::Flag::NoSpace);
const Debug::Flags previousFlags = debug.flags();
debug.setFlags(previousFlags|Debug::Flag::NoSpace);
/* Print foreground color */
debug << int(value.r()) << ";" << int(value.g()) << ";"

60
src/Magnum/Math/Color.h

@ -1343,16 +1343,16 @@ template<class T> struct ColorHsv {
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{ColorHsv} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const ColorHsv<T>& value) {
return debug << "ColorHsv(" << Corrade::Utility::Debug::nospace << value.hue
<< Corrade::Utility::Debug::nospace << "," << value.saturation
<< Corrade::Utility::Debug::nospace << "," << value.value
<< Corrade::Utility::Debug::nospace << ")";
template<class T> Debug& operator<<(Debug& debug, const ColorHsv<T>& value) {
return debug << "ColorHsv(" << Debug::nospace << value.hue
<< Debug::nospace << "," << value.saturation
<< Debug::nospace << "," << value.value
<< Debug::nospace << ")";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const ColorHsv<Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const ColorHsv<Float>&);
#endif
#endif
@ -1527,22 +1527,20 @@ inline Color4<Float> operator "" _srgbaf(unsigned long long value) {
/**
@debugoperator{Color3}
If @ref Corrade::Utility::Debug::Flag::Color is enabled or
@ref Corrade::Utility::Debug::color was set immediately before, prints the
value as an ANSI 24bit color escape sequence using two successive Unicode block
characters (to have it roughly square). To preserve at least some information
when text is copied, the square consists of one of the five
@cb{.shell-session} @ce shades, however the color is set for both
If @ref Debug::Flag::Color is enabled or @ref Debug::color was set immediately
before, prints the value as an ANSI 24bit color escape sequence using two
successive Unicode block characters (to have it roughly square). To preserve at
least some information when text is copied, the square consists of one of the
five @cb{.shell-session} @ce shades, however the color is set for both
foreground and background so the actual block character is indistinguishable
when seen on a terminal.
If @ref Corrade::Utility::Debug::Flag::Color is enabled and
@ref Corrade::Utility::Debug::Flag::DisableColors is set, only the shaded
character is used, without any ANSI color escape sequence.
If @ref Debug::Flag::Color is enabled and @ref Debug::Flag::DisableColors is
set, only the shaded character is used, without any ANSI color escape sequence.
If @ref Corrade::Utility::Debug::Flag::Color is not enabled, the value is
printed as a hex color (e.g. @cb{.shell-session} #ff33aa @ce). Other underlying
types are handled by @ref operator<<(Corrade::Utility::Debug&, const Vector<size, T>&).
If @ref Debug::Flag::Color is not enabled, the value is printed as a hex color
(e.g. @cb{.shell-session} #ff33aa @ce). Other underlying types are handled by
@ref operator<<(Debug&, const Vector<size, T>&).
For example, the following snippet:
@ -1556,28 +1554,26 @@ prints the following on terminals that support it:
@include MathColor3-debug.ansi
*/
MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color3<UnsignedByte>& value);
MAGNUM_EXPORT Debug& operator<<(Debug& debug, const Color3<UnsignedByte>& value);
/**
@debugoperator{Color4}
If @ref Corrade::Utility::Debug::Flag::Color is enabled or
@ref Corrade::Utility::Debug::color was set immediately before, prints the
value as an ANSI 24bit color escape sequence using two successive Unicode block
characters (to have it roughly square). To preserve at least some information
when text is copied, the square consists of one of the five
@cb{.shell-session} @ce shades. The square shade is calculated as a
If @ref Debug::Flag::Color is enabled or @ref Debug::color was set immediately
before, prints the value as an ANSI 24bit color escape sequence using two
successive Unicode block characters (to have it roughly square). To preserve at
least some information when text is copied, the square consists of one of the
five @cb{.shell-session} @ce shades. The square shade is calculated as a
product of @ref Color4::value() and @ref Color4::a(). If calculated color value
is less than alpha, the colored square has the color set for both background
and foreground, otherwise the background is left at the default.
If @ref Corrade::Utility::Debug::Flag::Color is enabled and
@ref Corrade::Utility::Debug::Flag::DisableColors is set, only the shaded
character is used, without any ANSI color escape sequence.
If @ref Debug::Flag::Color is enabled and @ref Debug::Flag::DisableColors is
set, only the shaded character is used, without any ANSI color escape sequence.
If @ref Corrade::Utility::Debug::Flag::Color is not enabled, the value is
printed as a hex color (e.g. @cb{.shell-session} #ff33aaff @ce). Other
underlying types are handled by @ref operator<<(Corrade::Utility::Debug&, const Vector<size, T>&).
If @ref Debug::Flag::Color is not enabled, the value is printed as a hex color
(e.g. @cb{.shell-session} #ff33aaff @ce). Other underlying types are handled by
@ref operator<<(Debug&, const Vector<size, T>&).
For example, the following snippet:
@ -1591,7 +1587,7 @@ prints the following on terminals that support it:
@include MathColor4-debug.ansi
*/
MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color4<UnsignedByte>& value);
MAGNUM_EXPORT Debug& operator<<(Debug& debug, const Color4<UnsignedByte>& value);
#endif
namespace Implementation {

11
src/Magnum/Math/ColorBatch.h

@ -32,6 +32,7 @@
#include <Corrade/Containers/Containers.h>
#include "Magnum/Magnum.h"
#include "Magnum/visibility.h"
namespace Magnum { namespace Math {
@ -55,7 +56,7 @@ expected to be contiguous with size of 8.
@ref CompressedPixelFormat::Bc1RGBAUnorm,
@ref CompressedPixelFormat::Bc1RGBASrgb
*/
MAGNUM_EXPORT void yFlipBc1InPlace(const Corrade::Containers::StridedArrayView4D<char>& blocks);
MAGNUM_EXPORT void yFlipBc1InPlace(const Containers::StridedArrayView4D<char>& blocks);
/**
@brief Y-flip BC2 texture blocks in-place
@ -74,7 +75,7 @@ expected to be contiguous with size of 16.
@see @ref CompressedPixelFormat::Bc2RGBAUnorm,
@ref CompressedPixelFormat::Bc2RGBASrgb
*/
MAGNUM_EXPORT void yFlipBc2InPlace(const Corrade::Containers::StridedArrayView4D<char>& blocks);
MAGNUM_EXPORT void yFlipBc2InPlace(const Containers::StridedArrayView4D<char>& blocks);
/**
@brief Y-flip BC3 texture blocks in-place
@ -96,7 +97,7 @@ same as performing @ref yFlipBc4InPlace() on the first half and
@see @ref CompressedPixelFormat::Bc3RGBAUnorm,
@ref CompressedPixelFormat::Bc3RGBASrgb
*/
MAGNUM_EXPORT void yFlipBc3InPlace(const Corrade::Containers::StridedArrayView4D<char>& blocks);
MAGNUM_EXPORT void yFlipBc3InPlace(const Containers::StridedArrayView4D<char>& blocks);
/**
@brief Y-flip BC4 texture blocks in-place
@ -115,7 +116,7 @@ expected to be contiguous with size of 8.
@see @ref CompressedPixelFormat::Bc4RUnorm,
@ref CompressedPixelFormat::Bc4RSnorm
*/
MAGNUM_EXPORT void yFlipBc4InPlace(const Corrade::Containers::StridedArrayView4D<char>& blocks);
MAGNUM_EXPORT void yFlipBc4InPlace(const Containers::StridedArrayView4D<char>& blocks);
/**
@brief Y-flip BC5 texture blocks in-place
@ -136,7 +137,7 @@ halves of each block.
@see @ref CompressedPixelFormat::Bc5RGUnorm,
@ref CompressedPixelFormat::Bc5RGSnorm
*/
MAGNUM_EXPORT void yFlipBc5InPlace(const Corrade::Containers::StridedArrayView4D<char>& blocks);
MAGNUM_EXPORT void yFlipBc5InPlace(const Containers::StridedArrayView4D<char>& blocks);
}}

14
src/Magnum/Math/Complex.h

@ -653,22 +653,22 @@ template<class T> inline Complex<T> Complex<T>::fromMatrix(const Matrix2x2<T>& m
Vector::isNormalized(), which compares the dot product (length squared)
to 1 ± 2ε. */
CORRADE_DEBUG_ASSERT(std::abs(matrix.determinant() - T(1)) < T(2)*TypeTraits<T>::epsilon(),
"Math::Complex::fromMatrix(): the matrix is not a rotation:" << Corrade::Utility::Debug::newline << matrix, {});
"Math::Complex::fromMatrix(): the matrix is not a rotation:" << Debug::newline << matrix, {});
return Implementation::complexFromMatrix(matrix);
}
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{Complex} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Complex<T>& value) {
return debug << "Complex(" << Corrade::Utility::Debug::nospace
<< value.real() << Corrade::Utility::Debug::nospace << ","
<< value.imaginary() << Corrade::Utility::Debug::nospace << ")";
template<class T> Debug& operator<<(Debug& debug, const Complex<T>& value) {
return debug << "Complex(" << Debug::nospace
<< value.real() << Debug::nospace << ","
<< value.imaginary() << Debug::nospace << ")";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Complex<Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Complex<Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Complex<Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Complex<Double>&);
#endif
#endif

34
src/Magnum/Math/CubicHermite.h

@ -280,27 +280,27 @@ template<class T> using CubicHermiteQuaternion = CubicHermite<Quaternion<T>>;
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{CubicHermite} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const CubicHermite<T>& value) {
return debug << "CubicHermite(" << Corrade::Utility::Debug::nospace
<< value.inTangent() << Corrade::Utility::Debug::nospace << ","
<< value.point() << Corrade::Utility::Debug::nospace << ","
<< value.outTangent() << Corrade::Utility::Debug::nospace << ")";
template<class T> Debug& operator<<(Debug& debug, const CubicHermite<T>& value) {
return debug << "CubicHermite(" << Debug::nospace
<< value.inTangent() << Debug::nospace << ","
<< value.point() << Debug::nospace << ","
<< value.outTangent() << Debug::nospace << ")";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector2<Float>>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector3<Float>>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector4<Float>>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector2<Double>>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector3<Double>>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector4<Double>>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Complex<Float>>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Complex<Double>>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Quaternion<Float>>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Quaternion<Double>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Vector2<Float>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Vector3<Float>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Vector4<Float>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Vector2<Double>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Vector3<Double>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Vector4<Double>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Complex<Float>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Complex<Double>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Quaternion<Float>>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const CubicHermite<Quaternion<Double>>&);
#endif
#endif

8
src/Magnum/Math/Dual.h

@ -376,10 +376,10 @@ template<class T, class U, class V = typename std::enable_if<!Implementation::Is
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{Dual} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Dual<T>& value) {
return debug << "Dual(" << Corrade::Utility::Debug::nospace
<< value.real() << Corrade::Utility::Debug::nospace << ","
<< value.dual() << Corrade::Utility::Debug::nospace << ")";
template<class T> Debug& operator<<(Debug& debug, const Dual<T>& value) {
return debug << "Dual(" << Debug::nospace
<< value.real() << Debug::nospace << ","
<< value.dual() << Debug::nospace << ")";
}
#endif

20
src/Magnum/Math/DualComplex.h

@ -103,7 +103,7 @@ template<class T> class DualComplex: public Dual<Complex<T>> {
*/
static DualComplex<T> fromMatrix(const Matrix3<T>& matrix) {
CORRADE_DEBUG_ASSERT(matrix.isRigidTransformation(),
"Math::DualComplex::fromMatrix(): the matrix doesn't represent rigid transformation:" << Corrade::Utility::Debug::newline << matrix, {});
"Math::DualComplex::fromMatrix(): the matrix doesn't represent rigid transformation:" << Debug::newline << matrix, {});
return {Implementation::complexFromMatrix(matrix.rotationScaling()), Complex<T>(matrix.translation())};
}
@ -405,19 +405,19 @@ MAGNUM_DUAL_OPERATOR_IMPLEMENTATION(DualComplex, Vector2, T)
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{DualComplex} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const DualComplex<T>& value) {
return debug << "DualComplex({" << Corrade::Utility::Debug::nospace
<< value.real().real() << Corrade::Utility::Debug::nospace << ","
<< value.real().imaginary() << Corrade::Utility::Debug::nospace << "}, {"
<< Corrade::Utility::Debug::nospace
<< value.dual().real() << Corrade::Utility::Debug::nospace << ","
<< value.dual().imaginary() << Corrade::Utility::Debug::nospace << "})";
template<class T> Debug& operator<<(Debug& debug, const DualComplex<T>& value) {
return debug << "DualComplex({" << Debug::nospace
<< value.real().real() << Debug::nospace << ","
<< value.real().imaginary() << Debug::nospace << "}, {"
<< Debug::nospace
<< value.dual().real() << Debug::nospace << ","
<< value.dual().imaginary() << Debug::nospace << "})";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualComplex<Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualComplex<Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const DualComplex<Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const DualComplex<Double>&);
#endif
#endif

28
src/Magnum/Math/DualQuaternion.h

@ -241,7 +241,7 @@ template<class T> class DualQuaternion: public Dual<Quaternion<T>> {
*/
static DualQuaternion<T> fromMatrix(const Matrix4<T>& matrix) {
CORRADE_DEBUG_ASSERT(matrix.isRigidTransformation(),
"Math::DualQuaternion::fromMatrix(): the matrix doesn't represent a rigid transformation:" << Corrade::Utility::Debug::newline << matrix, {});
"Math::DualQuaternion::fromMatrix(): the matrix doesn't represent a rigid transformation:" << Debug::newline << matrix, {});
Quaternion<T> q = Implementation::quaternionFromMatrix(matrix.rotationScaling());
return {q, Quaternion<T>(matrix.translation()/2)*q};
@ -569,23 +569,23 @@ MAGNUM_DUAL_OPERATOR_IMPLEMENTATION(DualQuaternion, Quaternion, T)
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{DualQuaternion} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const DualQuaternion<T>& value) {
return debug << "DualQuaternion({{" << Corrade::Utility::Debug::nospace
<< value.real().vector().x() << Corrade::Utility::Debug::nospace << ","
<< value.real().vector().y() << Corrade::Utility::Debug::nospace << ","
<< value.real().vector().z() << Corrade::Utility::Debug::nospace << "},"
<< value.real().scalar() << Corrade::Utility::Debug::nospace << "}, {{"
<< Corrade::Utility::Debug::nospace
<< value.dual().vector().x() << Corrade::Utility::Debug::nospace << ","
<< value.dual().vector().y() << Corrade::Utility::Debug::nospace << ","
<< value.dual().vector().z() << Corrade::Utility::Debug::nospace << "},"
<< value.dual().scalar() << Corrade::Utility::Debug::nospace << "})";
template<class T> Debug& operator<<(Debug& debug, const DualQuaternion<T>& value) {
return debug << "DualQuaternion({{" << Debug::nospace
<< value.real().vector().x() << Debug::nospace << ","
<< value.real().vector().y() << Debug::nospace << ","
<< value.real().vector().z() << Debug::nospace << "},"
<< value.real().scalar() << Debug::nospace << "}, {{"
<< Debug::nospace
<< value.dual().vector().x() << Debug::nospace << ","
<< value.dual().vector().y() << Debug::nospace << ","
<< value.dual().vector().z() << Debug::nospace << "},"
<< value.dual().scalar() << Debug::nospace << "})";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualQuaternion<Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualQuaternion<Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const DualQuaternion<Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const DualQuaternion<Double>&);
#endif
#endif

18
src/Magnum/Math/Frustum.h

@ -167,9 +167,9 @@ template<class T> class Frustum {
* @m_deprecated_since{2019,10} Use @ref operator[](std::size_t) const,
* @ref data() or @ref begin() / @ref end() instead.
*/
constexpr CORRADE_DEPRECATED("use operator[](), data() or begin() / end() instead") Corrade::Containers::StaticArrayView<6, const Vector4<T>> planes() const {
constexpr CORRADE_DEPRECATED("use operator[](), data() or begin() / end() instead") Containers::StaticArrayView<6, const Vector4<T>> planes() const {
/* GCC 4.8 needs explicit construction */
return Corrade::Containers::StaticArrayView<6, const Vector4<T>>{_data};
return Containers::StaticArrayView<6, const Vector4<T>>{_data};
}
#endif
@ -281,22 +281,22 @@ template<class T> class Frustum {
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{Frustum} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Frustum<T>& value) {
debug << "Frustum({" << Corrade::Utility::Debug::nospace;
template<class T> Debug& operator<<(Debug& debug, const Frustum<T>& value) {
debug << "Frustum({" << Debug::nospace;
for(std::size_t i = 0; i != 6; ++i) {
if(i != 0) debug << Corrade::Utility::Debug::nospace << "},\n {" << Corrade::Utility::Debug::nospace;
if(i != 0) debug << Debug::nospace << "},\n {" << Debug::nospace;
for(std::size_t j = 0; j != 4; ++j) {
if(j != 0) debug << Corrade::Utility::Debug::nospace << ",";
if(j != 0) debug << Debug::nospace << ",";
debug << value[i][j];
}
}
return debug << Corrade::Utility::Debug::nospace << "})";
return debug << Debug::nospace << "})";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Frustum<Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Frustum<Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Frustum<Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Frustum<Double>&);
#endif
#endif

4
src/Magnum/Math/Functions.cpp

@ -70,7 +70,7 @@ UnsignedInt log2(UnsignedInt number) {
UnsignedLong binomialCoefficient(const UnsignedInt n, UnsignedInt k) {
CORRADE_DEBUG_ASSERT(n >= k,
"Math::binomialCoefficient(): k can't be greater than n in (" << Corrade::Utility::Debug::nospace << n << "choose" << k << Corrade::Utility::Debug::nospace << ")", {});
"Math::binomialCoefficient(): k can't be greater than n in (" << Debug::nospace << n << "choose" << k << Debug::nospace << ")", {});
/* k and n - k gives the same value, optimize the calculation to do fewer
steps */
@ -81,7 +81,7 @@ UnsignedLong binomialCoefficient(const UnsignedInt n, UnsignedInt k) {
UnsignedLong result = n;
for(UnsignedInt i = 2; i <= k; ++i) {
CORRADE_DEBUG_ASSERT(result < ~UnsignedLong{} / (n-i+1),
"Math::binomialCoefficient(): overflow for (" << Corrade::Utility::Debug::nospace << n << "choose" << k << Corrade::Utility::Debug::nospace << ")", {});
"Math::binomialCoefficient(): overflow for (" << Debug::nospace << n << "choose" << k << Debug::nospace << ")", {});
result *= n - i + 1;
result /= i;

16
src/Magnum/Math/Functions.h

@ -244,7 +244,7 @@ the operations component-wise.
@m_since{2019,10}
@see @ref isNan(), @ref Constants::inf(),
@ref isInf(const Corrade::Containers::StridedArrayView1D<const T>&)
@ref isInf(const Containers::StridedArrayView1D<const T>&)
*/
template<class T> inline typename std::enable_if<IsScalar<T>::value, bool>::type isInf(T value) {
return std::isinf(UnderlyingTypeOf<T>(value));
@ -267,7 +267,7 @@ template<std::size_t size, class T> inline BitVector<size> isInf(const Vector<si
Equivalent to @cpp value != value @ce.
@see @ref isInf(), @ref Constants::nan(),
@ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&)
@ref isNan(const Containers::StridedArrayView1D<const T>&)
*/
/* defined in Vector.h */
template<class T> typename std::enable_if<IsScalar<T>::value, bool>::type isNan(T value);
@ -288,8 +288,8 @@ template<std::size_t size, class T> inline BitVector<size> isNan(const Vector<si
<em>NaN</em>s passed in the @p value parameter are propagated.
@see @ref max(), @ref minmax(), @ref clamp(),
@ref min(const Corrade::Containers::StridedArrayView1D<const T>&),
@ref Vector::min(), @ref Corrade::Utility::min()
@ref min(const Containers::StridedArrayView1D<const T>&),
@ref Vector::min(), @ref Utility::min()
*/
/* defined in Vector.h */
template<class T> constexpr typename std::enable_if<IsScalar<T>::value, T>::type min(T value, T min);
@ -315,8 +315,8 @@ template<std::size_t size, class T> inline Vector<size, T> min(const Vector<size
<em>NaN</em>s passed in the @p value parameter are propagated.
@see @ref min(), @ref minmax(), @ref clamp(),
@ref max(const Corrade::Containers::StridedArrayView1D<const T>&),
@ref Vector::max(), @ref Corrade::Utility::max()
@ref max(const Containers::StridedArrayView1D<const T>&),
@ref Vector::max(), @ref Utility::max()
*/
/* defined in Vector.h */
template<class T> constexpr typename std::enable_if<IsScalar<T>::value, T>::type max(T a, T b);
@ -341,7 +341,7 @@ template<std::size_t size, class T> inline Vector<size, T> max(const Vector<size
@brief Minimum and maximum of two values
@see @ref min(), @ref max(), @ref clamp(),
@ref minmax(const Corrade::Containers::StridedArrayView1D<const T>&),
@ref minmax(const Containers::StridedArrayView1D<const T>&),
@ref Vector::minmax(),
@ref Range::Range(const std::pair<VectorType, VectorType>&)
*/
@ -351,7 +351,7 @@ template<class T> inline typename std::enable_if<IsScalar<T>::value, std::pair<T
/** @overload */
template<std::size_t size, class T> inline std::pair<Vector<size, T>, Vector<size, T>> minmax(const Vector<size, T>& a, const Vector<size, T>& b) {
using Corrade::Utility::swap;
using Utility::swap;
std::pair<Vector<size, T>, Vector<size, T>> out{a, b};
for(std::size_t i = 0; i != size; ++i)
if(out.first[i] > out.second[i]) swap(out.first[i], out.second[i]);

88
src/Magnum/Math/FunctionsBatch.h

@ -40,9 +40,9 @@ namespace Implementation {
/** @todo Utility/Algorithms.h has a similar (but different) variant of this,
maybe turn that into some public utility once we have one more use case? */
template<class T, class View = decltype(Corrade::Containers::Implementation::ErasedArrayViewConverter<typename std::remove_reference<T&&>::type>::from(std::declval<T&&>()))> static auto stridedArrayViewTypeFor(T&&) -> typename std::remove_const<typename View::Type>::type;
template<class T> static typename std::remove_const<T>::type stridedArrayViewTypeFor(const Corrade::Containers::ArrayView<T>&);
template<class T> static typename std::remove_const<T>::type stridedArrayViewTypeFor(const Corrade::Containers::StridedArrayView1D<T>&);
template<class T, class View = decltype(Containers::Implementation::ErasedArrayViewConverter<typename std::remove_reference<T&&>::type>::from(std::declval<T&&>()))> static auto stridedArrayViewTypeFor(T&&) -> typename std::remove_const<typename View::Type>::type;
template<class T> static typename std::remove_const<T>::type stridedArrayViewTypeFor(const Containers::ArrayView<T>&);
template<class T> static typename std::remove_const<T>::type stridedArrayViewTypeFor(const Containers::StridedArrayView1D<T>&);
}
@ -62,7 +62,7 @@ set to @cpp 1 @ce if any value has that component infinite. If the range is
empty, returns @cpp false @ce or a @ref BitVector with no bits set.
@see @ref isInf(T), @ref Constants::inf()
*/
template<class T> auto isInf(const Corrade::Containers::StridedArrayView1D<const T>& range) -> decltype(isInf(std::declval<T>())) {
template<class T> auto isInf(const Containers::StridedArrayView1D<const T>& range) -> decltype(isInf(std::declval<T>())) {
if(range.isEmpty()) return {};
/* For scalars, this loop exits once any value is infinity. For vectors
@ -81,28 +81,28 @@ template<class T> auto isInf(const Corrade::Containers::StridedArrayView1D<const
@overload
@m_since{2020,06}
Converts @p range to @ref Corrade::Containers::StridedArrayView1D and calls the
above overload. Works with any type that's convertible to
@ref Corrade::Containers::StridedArrayView.
Converts @p range to @ref Containers::StridedArrayView1D and calls the above
overload. Works with any type that's convertible to
@relativeref{Corrade,Containers::StridedArrayView}.
*/
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::declval<Iterable&&>()))> inline auto isInf(Iterable&& range) -> decltype(isInf(std::declval<T>())) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return isInf<T>(Corrade::Containers::StridedArrayView1D<const T>{range});
return isInf<T>(Containers::StridedArrayView1D<const T>{range});
}
/** @overload */
template<class T> inline auto isInf(std::initializer_list<T> list) -> decltype(isInf(std::declval<T>())) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return isInf<T>(Corrade::Containers::stridedArrayView(list));
return isInf<T>(Containers::stridedArrayView(list));
}
/** @overload */
template<class T, std::size_t size> inline auto isInf(const T(&array)[size]) -> decltype(isInf(std::declval<T>())) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return isInf<T>(Corrade::Containers::StridedArrayView1D<const T>{array});
return isInf<T>(Containers::StridedArrayView1D<const T>{array});
}
/**
@ -114,7 +114,7 @@ set to @cpp 1 @ce if any value has that component NaN. If the range is empty,
returns @cpp false @ce or a @ref BitVector with no bits set.
@see @ref isNan(T), @ref Constants::nan()
*/
template<class T> inline auto isNan(const Corrade::Containers::StridedArrayView1D<const T>& range) -> decltype(isNan(std::declval<T>())) {
template<class T> inline auto isNan(const Containers::StridedArrayView1D<const T>& range) -> decltype(isNan(std::declval<T>())) {
if(range.isEmpty()) return {};
/* For scalars, this loop exits once any value is infinity. For vectors
@ -133,38 +133,38 @@ template<class T> inline auto isNan(const Corrade::Containers::StridedArrayView1
@overload
@m_since{2020,06}
Converts @p range to @ref Corrade::Containers::StridedArrayView1D and calls the
above overload. Works with any type that's convertible to
@ref Corrade::Containers::StridedArrayView.
Converts @p range to @ref Containers::StridedArrayView1D and calls the above
overload. Works with any type that's convertible to
@relativeref{Corrade,Containers::StridedArrayView}.
*/
/* See isInf() for why arrayView() and not stridedArrayView() */
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::declval<Iterable&&>()))> inline auto isNan(Iterable&& range) -> decltype(isNan(std::declval<T>())) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return isNan<T>(Corrade::Containers::StridedArrayView1D<const T>{range});
return isNan<T>(Containers::StridedArrayView1D<const T>{range});
}
/** @overload */
template<class T> inline auto isNan(std::initializer_list<T> list) -> decltype(isNan(std::declval<T>())) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return isNan<T>(Corrade::Containers::stridedArrayView(list));
return isNan<T>(Containers::stridedArrayView(list));
}
/** @overload */
template<class T, std::size_t size> inline auto isNan(const T(&array)[size]) -> decltype(isNan(std::declval<T>())) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return isNan<T>(Corrade::Containers::StridedArrayView1D<const T>{array});
return isNan<T>(Containers::StridedArrayView1D<const T>{array});
}
namespace Implementation {
/* Non-floating-point types, the first is a non-NaN for sure */
template<class T, bool any> constexpr std::pair<std::size_t, T> firstNonNan(Corrade::Containers::StridedArrayView1D<const T> range, std::false_type, std::integral_constant<bool, any>) {
template<class T, bool any> constexpr std::pair<std::size_t, T> firstNonNan(Containers::StridedArrayView1D<const T> range, std::false_type, std::integral_constant<bool, any>) {
return {0, range.front()};
}
/* Floating-point scalars, return the first that's not NaN */
template<class T> inline std::pair<std::size_t, T> firstNonNan(Corrade::Containers::StridedArrayView1D<const T> range, std::true_type, std::false_type) {
template<class T> inline std::pair<std::size_t, T> firstNonNan(Containers::StridedArrayView1D<const T> range, std::true_type, std::false_type) {
/* Find the first non-NaN value to compare against. If all are NaN,
return the last value so the following loop in min/max/minmax()
doesn't even execute. */
@ -179,7 +179,7 @@ namespace Implementation {
apply the min/max/minmax operation. I expect the cases of heavily
NaN-filled vectors (and thus the need to loop twice through most of the
range) to be very rare, so this shouldn't be a problem. */
template<class T> inline std::pair<std::size_t, T> firstNonNan(Corrade::Containers::StridedArrayView1D<const T> range, std::true_type, std::true_type) {
template<class T> inline std::pair<std::size_t, T> firstNonNan(Containers::StridedArrayView1D<const T> range, std::true_type, std::true_type) {
T out = range[0];
std::size_t firstValid = 0;
for(std::size_t i = 1; i != range.size(); ++i) {
@ -197,9 +197,9 @@ namespace Implementation {
If the range is empty, returns default-constructed value. <em>NaN</em>s are
ignored, unless the range is all <em>NaN</em>s.
@see @ref min(T, T), @ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&)
@see @ref min(T, T), @ref isNan(const Containers::StridedArrayView1D<const T>&)
*/
template<class T> inline T min(const Corrade::Containers::StridedArrayView1D<const T>& range) {
template<class T> inline T min(const Containers::StridedArrayView1D<const T>& range) {
if(range.isEmpty()) return {};
std::pair<std::size_t, T> iOut = Implementation::firstNonNan(range, IsFloatingPoint<T>{}, IsVector<T>{});
@ -213,28 +213,28 @@ template<class T> inline T min(const Corrade::Containers::StridedArrayView1D<con
@overload
@m_since{2020,06}
Converts @p range to @ref Corrade::Containers::StridedArrayView1D and calls the
above overload. Works with any type that's convertible to
@ref Corrade::Containers::StridedArrayView.
Converts @p range to @ref Containers::StridedArrayView1D and calls the above
overload. Works with any type that's convertible to
@relativeref{Corrade,Containers::StridedArrayView}.
*/
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::declval<Iterable&&>()))> inline T min(Iterable&& range) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return min<T>(Corrade::Containers::StridedArrayView1D<const T>{range});
return min<T>(Containers::StridedArrayView1D<const T>{range});
}
/** @overload */
template<class T> inline T min(std::initializer_list<T> list) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return min<T>(Corrade::Containers::stridedArrayView(list));
return min<T>(Containers::stridedArrayView(list));
}
/** @overload */
template<class T, std::size_t size> inline T min(const T(&array)[size]) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return min<T>(Corrade::Containers::StridedArrayView1D<const T>{array});
return min<T>(Containers::StridedArrayView1D<const T>{array});
}
/**
@ -242,9 +242,9 @@ template<class T, std::size_t size> inline T min(const T(&array)[size]) {
If the range is empty, returns default-constructed value. <em>NaN</em>s are
ignored, unless the range is all <em>NaN</em>s.
@see @ref max(T, T), @ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&)
@see @ref max(T, T), @ref isNan(const Containers::StridedArrayView1D<const T>&)
*/
template<class T> inline T max(const Corrade::Containers::StridedArrayView1D<const T>& range) {
template<class T> inline T max(const Containers::StridedArrayView1D<const T>& range) {
if(range.isEmpty()) return {};
std::pair<std::size_t, T> iOut = Implementation::firstNonNan(range, IsFloatingPoint<T>{}, IsVector<T>{});
@ -258,28 +258,28 @@ template<class T> inline T max(const Corrade::Containers::StridedArrayView1D<con
@overload
@m_since{2020,06}
Converts @p range to @ref Corrade::Containers::StridedArrayView1D and calls the
above overload. Works with any type that's convertible to
@ref Corrade::Containers::StridedArrayView.
Converts @p range to @ref Containers::StridedArrayView1D and calls the above
overload. Works with any type that's convertible to
@relativeref{Corrade,Containers::StridedArrayView}.
*/
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::declval<Iterable&&>()))> inline T max(Iterable&& range) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return max<T>(Corrade::Containers::StridedArrayView1D<const T>{range});
return max<T>(Containers::StridedArrayView1D<const T>{range});
}
/** @overload */
template<class T> inline T max(std::initializer_list<T> list) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return max<T>(Corrade::Containers::stridedArrayView(list));
return max<T>(Containers::stridedArrayView(list));
}
/** @overload */
template<class T, std::size_t size> inline T max(const T(&array)[size]) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return max<T>(Corrade::Containers::StridedArrayView1D<const T>{array});
return max<T>(Containers::StridedArrayView1D<const T>{array});
}
namespace Implementation {
@ -302,9 +302,9 @@ If the range is empty, returns default-constructed values. <em>NaN</em>s are
ignored, unless the range is all <em>NaN</em>s.
@see @ref minmax(T, T),
@ref Range::Range(const std::pair<VectorType, VectorType>&),
@ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&)
@ref isNan(const Containers::StridedArrayView1D<const T>&)
*/
template<class T> inline std::pair<T, T> minmax(const Corrade::Containers::StridedArrayView1D<const T>& range) {
template<class T> inline std::pair<T, T> minmax(const Containers::StridedArrayView1D<const T>& range) {
if(range.isEmpty()) return {};
std::pair<std::size_t, T> iOut = Implementation::firstNonNan(range, IsFloatingPoint<T>{}, IsVector<T>{});
@ -319,28 +319,28 @@ template<class T> inline std::pair<T, T> minmax(const Corrade::Containers::Strid
@overload
@m_since{2020,06}
Converts @p range to @ref Corrade::Containers::StridedArrayView1D and calls the
above overload. Works with any type that's convertible to
@ref Corrade::Containers::StridedArrayView.
Converts @p range to @ref Containers::StridedArrayView1D and calls the above
overload. Works with any type that's convertible to
@relativeref{Corrade,Containers::StridedArrayView}.
*/
template<class Iterable, class T = decltype(Implementation::stridedArrayViewTypeFor(std::declval<Iterable&&>()))> inline std::pair<T, T> minmax(Iterable&& range) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return minmax<T>(Corrade::Containers::StridedArrayView1D<const T>{range});
return minmax<T>(Containers::StridedArrayView1D<const T>{range});
}
/** @overload */
template<class T> inline std::pair<T, T> minmax(std::initializer_list<T> list) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return minmax<T>(Corrade::Containers::stridedArrayView(list));
return minmax<T>(Containers::stridedArrayView(list));
}
/** @overload */
template<class T, std::size_t size> inline std::pair<T, T> minmax(const T(&array)[size]) {
/* Specifying the template explicitly to avoid recursion into the generic
function again */
return minmax<T>(Corrade::Containers::StridedArrayView1D<const T>{array});
return minmax<T>(Containers::StridedArrayView1D<const T>{array});
}
/* Since 1.8.17, the original short-hand group closing doesn't work anymore.

2
src/Magnum/Math/Half.cpp

@ -37,7 +37,7 @@
namespace Magnum { namespace Math {
Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, Half value) {
Debug& operator<<(Debug& debug, Half value) {
std::ostringstream out;
/* Wikipedia says it's 3 or 4 decimal places:
https://en.wikipedia.org/wiki/Half-precision_floating-point_format */

9
src/Magnum/Math/Half.h

@ -34,6 +34,7 @@
#endif
#include "Magnum/visibility.h"
#include "Magnum/Magnum.h"
#include "Magnum/Math/Math.h"
#include "Magnum/Math/Tags.h"
@ -180,12 +181,10 @@ inline Half operator "" _h(long double value) { return Half(Float(value)); }
@debugoperator{Half}
Prints the value with 4 significant digits.
@see @ref Corrade::Utility::Debug::operator<<(float),
@ref Corrade::Utility::Debug::operator<<(double),
@ref Corrade::Utility::Debug::operator<<(long double value)
@todoc remove `long double value` once doxygen can link to long double overloads properly
@see @ref Debug::operator<<(float), @ref Debug::operator<<(double),
@ref Debug::operator<<(long double)
*/
MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, Half value);
MAGNUM_EXPORT Debug& operator<<(Debug& debug, Half value);
#endif
#ifndef MAGNUM_NO_MATH_STRICT_WEAK_ORDERING

2
src/Magnum/Math/Intersection.h

@ -573,7 +573,7 @@ template<class T> bool sphereConeView(const Vector3<T>& sphereCenter, const T sp
template<class T> bool sphereConeView(const Vector3<T>& sphereCenter, const T sphereRadius, const Matrix4<T>& coneView, const T sinAngle, const T tanAngle) {
CORRADE_DEBUG_ASSERT(coneView.isRigidTransformation(),
"Math::Intersection::sphereConeView(): coneView does not represent a rigid transformation:" << Corrade::Utility::Debug::newline << coneView, false);
"Math::Intersection::sphereConeView(): coneView does not represent a rigid transformation:" << Debug::newline << coneView, false);
/* Transform the sphere so that we can test against Z axis aligned origin
cone instead */

4
src/Magnum/Math/Matrix.h

@ -63,7 +63,7 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
*
* Equivalent to @ref Matrix(IdentityInitT, T).
*/
constexpr /*implicit*/ Matrix() noexcept: RectangularMatrix<size, size, T>{typename Corrade::Containers::Implementation::GenerateSequence<size>::Type{}, Vector<size, T>(T(1))} {}
constexpr /*implicit*/ Matrix() noexcept: RectangularMatrix<size, size, T>{typename Containers::Implementation::GenerateSequence<size>::Type{}, Vector<size, T>(T(1))} {}
/**
* @brief Construct an identity matrix
@ -275,7 +275,7 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
*/
Matrix<size, T> invertedOrthogonal() const {
CORRADE_DEBUG_ASSERT(isOrthogonal(),
"Math::Matrix::invertedOrthogonal(): the matrix is not orthogonal:" << Corrade::Utility::Debug::Debug::newline << *this, {});
"Math::Matrix::invertedOrthogonal(): the matrix is not orthogonal:" << Debug::Debug::newline << *this, {});
return RectangularMatrix<size, size, T>::transposed();
}

8
src/Magnum/Math/Matrix3.h

@ -765,7 +765,7 @@ template<class T> Matrix2x2<T> Matrix3<T>::rotation() const {
Matrix2x2<T> rotation{(*this)[0].xy().normalized(),
(*this)[1].xy().normalized()};
CORRADE_DEBUG_ASSERT(rotation.isOrthogonal(),
"Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:" << Corrade::Utility::Debug::newline << rotation, {});
"Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:" << Debug::newline << rotation, {});
return rotation;
}
@ -773,20 +773,20 @@ template<class T> Matrix2x2<T> Matrix3<T>::rotationNormalized() const {
Matrix2x2<T> rotation{(*this)[0].xy(),
(*this)[1].xy()};
CORRADE_DEBUG_ASSERT(rotation.isOrthogonal(),
"Math::Matrix3::rotationNormalized(): the rotation part is not orthogonal:" << Corrade::Utility::Debug::newline << rotation, {});
"Math::Matrix3::rotationNormalized(): the rotation part is not orthogonal:" << Debug::newline << rotation, {});
return rotation;
}
template<class T> T Matrix3<T>::uniformScalingSquared() const {
const T scalingSquared = (*this)[0].xy().dot();
CORRADE_DEBUG_ASSERT(TypeTraits<T>::equals((*this)[1].xy().dot(), scalingSquared),
"Math::Matrix3::uniformScaling(): the matrix doesn't have uniform scaling:" << Corrade::Utility::Debug::newline << rotationScaling(), {});
"Math::Matrix3::uniformScaling(): the matrix doesn't have uniform scaling:" << Debug::newline << rotationScaling(), {});
return scalingSquared;
}
template<class T> inline Matrix3<T> Matrix3<T>::invertedRigid() const {
CORRADE_DEBUG_ASSERT(isRigidTransformation(),
"Math::Matrix3::invertedRigid(): the matrix doesn't represent a rigid transformation:" << Corrade::Utility::Debug::newline << *this, {});
"Math::Matrix3::invertedRigid(): the matrix doesn't represent a rigid transformation:" << Debug::newline << *this, {});
Matrix2x2<T> inverseRotation = rotationScaling().transposed();
return from(inverseRotation, inverseRotation*-translation());

8
src/Magnum/Math/Matrix4.h

@ -1328,7 +1328,7 @@ template<class T> Matrix3x3<T> Matrix4<T>::rotation() const {
(*this)[1].xyz().normalized(),
(*this)[2].xyz().normalized()};
CORRADE_DEBUG_ASSERT(rotation.isOrthogonal(),
"Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:" << Corrade::Utility::Debug::newline << rotation, {});
"Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:" << Debug::newline << rotation, {});
return rotation;
}
@ -1337,7 +1337,7 @@ template<class T> Matrix3x3<T> Matrix4<T>::rotationNormalized() const {
(*this)[1].xyz(),
(*this)[2].xyz()};
CORRADE_DEBUG_ASSERT(rotation.isOrthogonal(),
"Math::Matrix4::rotationNormalized(): the rotation part is not orthogonal:" << Corrade::Utility::Debug::newline << rotation, {});
"Math::Matrix4::rotationNormalized(): the rotation part is not orthogonal:" << Debug::newline << rotation, {});
return rotation;
}
@ -1345,13 +1345,13 @@ template<class T> T Matrix4<T>::uniformScalingSquared() const {
const T scalingSquared = (*this)[0].xyz().dot();
CORRADE_DEBUG_ASSERT(TypeTraits<T>::equals((*this)[1].xyz().dot(), scalingSquared) &&
TypeTraits<T>::equals((*this)[2].xyz().dot(), scalingSquared),
"Math::Matrix4::uniformScaling(): the matrix doesn't have uniform scaling:" << Corrade::Utility::Debug::newline << rotationScaling(), {});
"Math::Matrix4::uniformScaling(): the matrix doesn't have uniform scaling:" << Debug::newline << rotationScaling(), {});
return scalingSquared;
}
template<class T> Matrix4<T> Matrix4<T>::invertedRigid() const {
CORRADE_DEBUG_ASSERT(isRigidTransformation(),
"Math::Matrix4::invertedRigid(): the matrix doesn't represent a rigid transformation:" << Corrade::Utility::Debug::newline << *this, {});
"Math::Matrix4::invertedRigid(): the matrix doesn't represent a rigid transformation:" << Debug::newline << *this, {});
Matrix3x3<T> inverseRotation = rotationScaling().transposed();
return from(inverseRotation, inverseRotation*-translation());

152
src/Magnum/Math/PackingBatch.cpp

@ -36,7 +36,7 @@ namespace Magnum { namespace Math {
namespace {
template<class T> inline void unpackUnsignedIntoImplementation(const Corrade::Containers::StridedArrayView2D<const T>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
template<class T> inline void unpackUnsignedIntoImplementation(const Containers::StridedArrayView2D<const T>& src, const Containers::StridedArrayView2D<Float>& dst) {
CORRADE_ASSERT(src.size() == dst.size(),
"Math::unpackInto(): wrong destination size, got" << dst.size() << "but expected" << src.size(), );
CORRADE_ASSERT(src.template isContiguous<1>(),
@ -67,17 +67,17 @@ template<class T> inline void unpackUnsignedIntoImplementation(const Corrade::Co
}
void unpackInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void unpackInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<Float>& dst) {
unpackUnsignedIntoImplementation(src, dst);
}
void unpackInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void unpackInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<Float>& dst) {
unpackUnsignedIntoImplementation(src, dst);
}
namespace {
template<class T> inline void unpackSignedIntoImplementation(const Corrade::Containers::StridedArrayView2D<const T>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
template<class T> inline void unpackSignedIntoImplementation(const Containers::StridedArrayView2D<const T>& src, const Containers::StridedArrayView2D<Float>& dst) {
CORRADE_ASSERT(src.size() == dst.size(),
"Math::unpackInto(): wrong destination size, got" << dst.size() << "but expected" << src.size(), );
CORRADE_ASSERT(src.template isContiguous<1>(),
@ -111,17 +111,17 @@ template<class T> inline void unpackSignedIntoImplementation(const Corrade::Cont
}
void unpackInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void unpackInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Float>& dst) {
unpackSignedIntoImplementation(src, dst);
}
void unpackInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void unpackInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Float>& dst) {
unpackSignedIntoImplementation(src, dst);
}
namespace {
template<class T> inline void packIntoImplementation(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<T>& dst) {
template<class T> inline void packIntoImplementation(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<T>& dst) {
CORRADE_ASSERT(src.size() == dst.size(),
"Math::packInto(): wrong destination size, got" << dst.size() << "but expected" << src.size(), );
CORRADE_ASSERT(src.isContiguous<1>(),
@ -153,25 +153,25 @@ template<class T> inline void packIntoImplementation(const Corrade::Containers::
}
void packInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst) {
void packInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst) {
packIntoImplementation(src, dst);
}
void packInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst) {
void packInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst) {
packIntoImplementation(src, dst);
}
void packInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst) {
void packInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Byte>& dst) {
packIntoImplementation(src, dst);
}
void packInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst) {
void packInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Short>& dst) {
packIntoImplementation(src, dst);
}
namespace {
template<class T, class U> inline void castIntoImplementation(const Corrade::Containers::StridedArrayView2D<const T>& src, const Corrade::Containers::StridedArrayView2D<U>& dst) {
template<class T, class U> inline void castIntoImplementation(const Containers::StridedArrayView2D<const T>& src, const Containers::StridedArrayView2D<U>& dst) {
CORRADE_ASSERT(src.size() == dst.size(),
"Math::castInto(): wrong destination size, got" << dst.size() << "but expected" << src.size(), );
CORRADE_ASSERT(src.template isContiguous<1>(),
@ -201,209 +201,209 @@ template<class T, class U> inline void castIntoImplementation(const Corrade::Con
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<Float>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Float>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<Float>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Float>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<Float>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Float>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<Double>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst) {
void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Double>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<Double>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst) {
void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Double>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<Double>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst) {
void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Double>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst) {
void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst) {
void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Byte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst) {
void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst) {
void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Short>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst) {
void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst) {
void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Int>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst) {
void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst) {
void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Byte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst) {
void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst) {
void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Short>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst) {
void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst) {
void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Int>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst) {
void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Short>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst) {
void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Int>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst) {
void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Int>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<UnsignedLong>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<UnsignedLong>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Long>& dst) {
void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Long>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<UnsignedLong>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<UnsignedLong>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Long>& dst) {
void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Long>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<UnsignedLong>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<UnsignedLong>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Long>& dst) {
void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Long>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedLong>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedLong>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Long>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst) {
void castInto(const Containers::StridedArrayView2D<const Long>& src, const Containers::StridedArrayView2D<Int>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedLong>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedLong>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Long>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst) {
void castInto(const Containers::StridedArrayView2D<const Long>& src, const Containers::StridedArrayView2D<Short>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedLong>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedLong>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Long>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst) {
void castInto(const Containers::StridedArrayView2D<const Long>& src, const Containers::StridedArrayView2D<Byte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst) {
void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Short>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst) {
void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Byte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst) {
void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Byte>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst) {
void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Double>& dst) {
castIntoImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Float>& dst) {
castIntoImplementation(src, dst);
}
namespace {
template<class T> inline void copyImplementation(const Corrade::Containers::StridedArrayView2D<const T>& src, const Corrade::Containers::StridedArrayView2D<T>& dst) {
template<class T> inline void copyImplementation(const Containers::StridedArrayView2D<const T>& src, const Containers::StridedArrayView2D<T>& dst) {
/* Utility::copy() has its own assertions, but those are debug-only for
perf reasons and don't require the second dimension to be contiguous.
Here the use case is different and the behavior should be consistent
@ -415,48 +415,48 @@ template<class T> inline void copyImplementation(const Corrade::Containers::Stri
CORRADE_ASSERT(dst.template isContiguous<1>(),
"Math::castInto(): second destination view dimension is not contiguous", );
Corrade::Utility::copy(src, dst);
Utility::copy(src, dst);
}
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst) {
copyImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst) {
void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Byte>& dst) {
copyImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst) {
copyImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst) {
void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Short>& dst) {
copyImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst) {
copyImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst) {
void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Int>& dst) {
copyImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedLong>& src, const Corrade::Containers::StridedArrayView2D<UnsignedLong>& dst) {
void castInto(const Containers::StridedArrayView2D<const UnsignedLong>& src, const Containers::StridedArrayView2D<UnsignedLong>& dst) {
copyImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Long>& src, const Corrade::Containers::StridedArrayView2D<Long>& dst) {
void castInto(const Containers::StridedArrayView2D<const Long>& src, const Containers::StridedArrayView2D<Long>& dst) {
copyImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Float>& dst) {
copyImplementation(src, dst);
}
void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst) {
void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Double>& dst) {
copyImplementation(src, dst);
}
@ -466,7 +466,7 @@ static_assert(sizeof(HalfMantissaTable) + sizeof(HalfOffsetTable) + sizeof(HalfE
static_assert(sizeof(HalfBaseTable) + sizeof(HalfShiftTable) == 1536,
"improper size of float->half conversion tables");
void unpackHalfInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst) {
void unpackHalfInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<Float>& dst) {
CORRADE_ASSERT(src.size() == dst.size(),
"Math::unpackHalfInto(): wrong destination size, got" << dst.size() << "but expected" << src.size(), );
CORRADE_ASSERT(src.isContiguous<1>(),
@ -493,7 +493,7 @@ void unpackHalfInto(const Corrade::Containers::StridedArrayView2D<const Unsigned
}
}
void packHalfInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst) {
void packHalfInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst) {
CORRADE_ASSERT(src.size() == dst.size(),
"Math::packHalfInto(): wrong destination size, got" << dst.size() << "but expected" << src.size(), );
CORRADE_ASSERT(src.isContiguous<1>(),

174
src/Magnum/Math/PackingBatch.h

@ -32,7 +32,7 @@
#include <Corrade/Containers/Containers.h>
#include "Magnum/Types.h"
#include "Magnum/Magnum.h"
#include "Magnum/visibility.h"
namespace Magnum { namespace Math {
@ -56,15 +56,15 @@ contain vector/matrix components, or have a size of 1 for scalars. Expects that
@p src and @p dst have the same size and that the second dimension in both is
contiguous.
@see @ref packInto(), @ref castInto(),
@ref Corrade::Containers::StridedArrayView::isContiguous()
@relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void unpackInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void unpackInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void unpackInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void unpackInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
@brief Unpack signed integral values into a floating-point representation
@ -78,15 +78,15 @@ contain vector/matrix components, or have a size of 1 for scalars. Expects that
@p src and @p dst have the same size and that the second dimension in both is
contiguous.
@see @ref packInto(), @ref castInto(),
@ref Corrade::Containers::StridedArrayView::isContiguous()
@relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void unpackInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void unpackInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void unpackInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void unpackInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
@brief Pack floating-point values into an integer representation
@ -105,27 +105,27 @@ contiguous.
range is undefined.
@see @ref unpackInto(), @ref castInto(),
@ref Corrade::Containers::StridedArrayView::isContiguous()
@relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void packInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst);
MAGNUM_EXPORT void packInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void packInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst);
MAGNUM_EXPORT void packInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Byte>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void packInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst);
MAGNUM_EXPORT void packInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void packInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst);
MAGNUM_EXPORT void packInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Short>& dst);
/**
@brief Pack 32-bit float values into 16-bit half-float representation
@ -144,7 +144,7 @@ Algorithm used: *Jeroen van der Zijp -- Fast Half Float Conversions, 2008,
ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf*
@see @ref Half
*/
MAGNUM_EXPORT void packHalfInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst);
MAGNUM_EXPORT void packHalfInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst);
/**
@brief Unpack a range of 16-bit half-float values into 32-bit float representation
@ -163,7 +163,7 @@ Algorithm used: *Jeroen van der Zijp -- Fast Half Float Conversions, 2008,
ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf*
@see @ref Half
*/
MAGNUM_EXPORT void unpackHalfInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void unpackHalfInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
@brief Cast integer values into a 32-bit floating-point representation
@ -180,40 +180,40 @@ the second dimension in both is contiguous.
@attention Numbers with more than 23 bits of precision will not be represented
accurately when cast into a @relativeref{Magnum,Float}.
@see @ref castInto(const Corrade::Containers::StridedArrayView2D<const Float>&, const Corrade::Containers::StridedArrayView2D<UnsignedByte>&),
@ref Corrade::Containers::StridedArrayView::isContiguous()
@see @ref castInto(const Containers::StridedArrayView2D<const Float>&, const Containers::StridedArrayView2D<UnsignedByte>&),
@relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
@brief Cast integer values into a 64-bit floating-point representation
@ -230,40 +230,40 @@ the second dimension in both is contiguous.
@attention Numbers with more than 52 bits of precision will not be represented
accurately when cast into a @relativeref{Magnum,Double}.
@see @ref castInto(const Corrade::Containers::StridedArrayView2D<const Double>&, const Corrade::Containers::StridedArrayView2D<UnsignedByte>&),
@ref Corrade::Containers::StridedArrayView::isContiguous()
@see @ref castInto(const Containers::StridedArrayView2D<const Double>&, const Containers::StridedArrayView2D<UnsignedByte>&),
@relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<Double>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Double>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<Double>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Double>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<Double>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Double>& dst);
/**
@brief Cast 32-bit floating-point values into an integer representation
@ -280,40 +280,40 @@ the second dimension in both is contiguous.
@attention Fractional part of the @relativeref{Magnum,Float} input will be
silently discarded when cast into an integer type.
@see @ref castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>&, const Corrade::Containers::StridedArrayView2D<Float>&),
@ref Corrade::Containers::StridedArrayView::isContiguous()
@see @ref castInto(const Containers::StridedArrayView2D<const UnsignedByte>&, const Containers::StridedArrayView2D<Float>&),
@relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Byte>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Short>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Int>& dst);
/**
@brief Cast 64-bit floating-point values into an integer representation
@ -330,40 +330,40 @@ the second dimension in both is contiguous.
@attention Fractional part of the @relativeref{Magnum,Double} input will be
silently discarded when cast into an integer type.
@see @ref castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>&, const Corrade::Containers::StridedArrayView2D<Double>&),
@ref Corrade::Containers::StridedArrayView::isContiguous()
@see @ref castInto(const Containers::StridedArrayView2D<const UnsignedByte>&, const Containers::StridedArrayView2D<Double>&),
@relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Byte>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Short>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Int>& dst);
/**
@brief Cast integer values into a differently sized type
@ -378,147 +378,147 @@ the second dimension in both is contiguous.
@attention Values that don't fit into the resulting type will have undefined
values.
@see @ref Corrade::Containers::StridedArrayView::isContiguous()
@see @relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Short>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Int>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Int>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<UnsignedLong>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<UnsignedLong>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Long>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Long>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<UnsignedLong>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<UnsignedLong>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Long>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Long>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<UnsignedLong>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<UnsignedLong>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Long>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Long>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedLong>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedLong>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Long>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Long>& src, const Containers::StridedArrayView2D<Int>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedLong>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedLong>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Long>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Long>& src, const Containers::StridedArrayView2D<Short>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedLong>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedLong>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Long>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Long>& src, const Containers::StridedArrayView2D<Byte>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Short>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst);
/**
* @overload
* @m_since{2020,06}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Byte>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Byte>& dst);
/**
@brief Cast 32-bit floating-point values into a 64-bit floating-point representation
@ -532,10 +532,10 @@ contain vector/matrix components, or have a size of 1 for scalars. Expects that
@p src and @p dst have the same size and that the second dimension in both is
contiguous.
@see @ref castInto(const Corrade::Containers::StridedArrayView2D<const Double>&, const Corrade::Containers::StridedArrayView2D<Float>&),
@ref Corrade::Containers::StridedArrayView::isContiguous()
@see @ref castInto(const Containers::StridedArrayView2D<const Double>&, const Containers::StridedArrayView2D<Float>&),
@relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Double>& dst);
/**
@brief Cast 64-bit floating-point values into a 32-bit floating-point representation
@ -552,10 +552,10 @@ contiguous.
@attention Numbers with more than 23 bits of precision will not be represented
accurately when cast into a @ref Magnum::Float "Float".
@see @ref castInto(const Corrade::Containers::StridedArrayView2D<const Float>&, const Corrade::Containers::StridedArrayView2D<Double>&),
@ref Corrade::Containers::StridedArrayView::isContiguous()
@see @ref castInto(const Containers::StridedArrayView2D<const Float>&, const Containers::StridedArrayView2D<Double>&),
@relativeref{Corrade,Containers::StridedArrayView::isContiguous()}
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
@brief Copy values
@ -568,61 +568,61 @@ same size, for consistency with other @ref castInto() expects also that the
second dimension in both is contiguous even though it's not required by
@relativeref{Corrade,Utility::copy()}.
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedByte>& src, const Corrade::Containers::StridedArrayView2D<UnsignedByte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedByte>& src, const Containers::StridedArrayView2D<UnsignedByte>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Byte>& src, const Corrade::Containers::StridedArrayView2D<Byte>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Byte>& src, const Containers::StridedArrayView2D<Byte>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedShort>& src, const Corrade::Containers::StridedArrayView2D<UnsignedShort>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedShort>& src, const Containers::StridedArrayView2D<UnsignedShort>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Short>& src, const Corrade::Containers::StridedArrayView2D<Short>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Short>& src, const Containers::StridedArrayView2D<Short>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedInt>& src, const Corrade::Containers::StridedArrayView2D<UnsignedInt>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedInt>& src, const Containers::StridedArrayView2D<UnsignedInt>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Int>& src, const Corrade::Containers::StridedArrayView2D<Int>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Int>& src, const Containers::StridedArrayView2D<Int>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const UnsignedLong>& src, const Corrade::Containers::StridedArrayView2D<UnsignedLong>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const UnsignedLong>& src, const Containers::StridedArrayView2D<UnsignedLong>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Long>& src, const Corrade::Containers::StridedArrayView2D<Long>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Long>& src, const Containers::StridedArrayView2D<Long>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Float>& src, const Corrade::Containers::StridedArrayView2D<Float>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Float>& src, const Containers::StridedArrayView2D<Float>& dst);
/**
* @overload
* @m_since_latest
*/
MAGNUM_EXPORT void castInto(const Corrade::Containers::StridedArrayView2D<const Double>& src, const Corrade::Containers::StridedArrayView2D<Double>& dst);
MAGNUM_EXPORT void castInto(const Containers::StridedArrayView2D<const Double>& src, const Containers::StridedArrayView2D<Double>& dst);
/* Since 1.8.17, the original short-hand group closing doesn't work anymore.
FFS. */

18
src/Magnum/Math/Quaternion.h

@ -790,18 +790,18 @@ template<class T> inline Quaternion<T> operator/(T scalar, const Quaternion<T>&
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{Quaternion} */
template<class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Quaternion<T>& value) {
return debug << "Quaternion({" << Corrade::Utility::Debug::nospace
<< value.vector().x() << Corrade::Utility::Debug::nospace << ","
<< value.vector().y() << Corrade::Utility::Debug::nospace << ","
<< value.vector().z() << Corrade::Utility::Debug::nospace << "},"
<< value.scalar() << Corrade::Utility::Debug::nospace << ")";
template<class T> Debug& operator<<(Debug& debug, const Quaternion<T>& value) {
return debug << "Quaternion({" << Debug::nospace
<< value.vector().x() << Debug::nospace << ","
<< value.vector().y() << Debug::nospace << ","
<< value.vector().z() << Debug::nospace << "},"
<< value.scalar() << Debug::nospace << ")";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Quaternion<Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Quaternion<Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Quaternion<Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Quaternion<Double>&);
#endif
#endif
@ -866,7 +866,7 @@ template<class T> inline Quaternion<T> Quaternion<T>::fromMatrix(const Matrix3x3
to Vector::isNormalized(), which compares the dot product (length
squared) to 1 ± 2ε. */
CORRADE_DEBUG_ASSERT(std::abs(matrix.determinant() - T(1)) < T(3)*TypeTraits<T>::epsilon(),
"Math::Quaternion::fromMatrix(): the matrix is not a rotation:" << Corrade::Utility::Debug::newline << matrix, {});
"Math::Quaternion::fromMatrix(): the matrix is not a rotation:" << Debug::newline << matrix, {});
return Implementation::quaternionFromMatrix(matrix);
}

32
src/Magnum/Math/Range.h

@ -792,28 +792,28 @@ template<UnsignedInt dimensions, class T> inline bool intersects(const Range<dim
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{Range} */
template<UnsignedInt dimensions, class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Range<dimensions, T>& value) {
debug << "Range({" << Corrade::Utility::Debug::nospace << Vector<dimensions, T>{value.min()}[0];
template<UnsignedInt dimensions, class T> Debug& operator<<(Debug& debug, const Range<dimensions, T>& value) {
debug << "Range({" << Debug::nospace << Vector<dimensions, T>{value.min()}[0];
for(UnsignedInt i = 1; i != dimensions; ++i)
debug << Corrade::Utility::Debug::nospace << "," << Vector<dimensions, T>{value.min()}[i];
debug << Corrade::Utility::Debug::nospace << "}, {"
<< Corrade::Utility::Debug::nospace << Vector<dimensions, T>{value.max()}[0];
debug << Debug::nospace << "," << Vector<dimensions, T>{value.min()}[i];
debug << Debug::nospace << "}, {"
<< Debug::nospace << Vector<dimensions, T>{value.max()}[0];
for(UnsignedInt i = 1; i != dimensions; ++i)
debug << Corrade::Utility::Debug::nospace << "," << Vector<dimensions, T>{value.max()}[i];
return debug << Corrade::Utility::Debug::nospace << "})";
debug << Debug::nospace << "," << Vector<dimensions, T>{value.max()}[i];
return debug << Debug::nospace << "})";
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<1, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<2, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<3, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<1, Int>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<2, Int>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<3, Int>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<1, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<2, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<3, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Range<1, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Range<2, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Range<3, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Range<1, Int>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Range<2, Int>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Range<3, Int>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Range<1, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Range<2, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Range<3, Double>&);
#endif
#endif

108
src/Magnum/Math/RectangularMatrix.h

@ -36,21 +36,21 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<std::size_t, std::size_t, class, class> struct RectangularMatrixConverter;
template<std::size_t cols, std::size_t rows, std::size_t otherCols, std::size_t otherRows, class T, std::size_t col, std::size_t ...row> constexpr Vector<rows, T> valueOrZeroVector(Corrade::Containers::Implementation::Sequence<row...>, const RectangularMatrix<otherCols, otherRows, T>& other) {
template<std::size_t cols, std::size_t rows, std::size_t otherCols, std::size_t otherRows, class T, std::size_t col, std::size_t ...row> constexpr Vector<rows, T> valueOrZeroVector(Containers::Implementation::Sequence<row...>, const RectangularMatrix<otherCols, otherRows, T>& other) {
return {(col < otherCols && row < otherRows ? other[col][row] : T{0})...};
}
template<std::size_t cols, std::size_t rows, std::size_t otherCols, std::size_t otherRows, class T, std::size_t col> constexpr Vector<rows, T> valueOrZeroVector(const RectangularMatrix<otherCols, otherRows, T>& other) {
return valueOrZeroVector<cols, rows, otherCols, otherRows, T, col>(typename Corrade::Containers::Implementation::GenerateSequence<rows>::Type{}, other);
return valueOrZeroVector<cols, rows, otherCols, otherRows, T, col>(typename Containers::Implementation::GenerateSequence<rows>::Type{}, other);
}
template<std::size_t cols, std::size_t rows, std::size_t otherCols, std::size_t otherRows, class T, std::size_t col, std::size_t ...row> constexpr Vector<rows, T> valueOrIdentityVector(Corrade::Containers::Implementation::Sequence<row...>, const RectangularMatrix<otherCols, otherRows, T>& other, T value) {
template<std::size_t cols, std::size_t rows, std::size_t otherCols, std::size_t otherRows, class T, std::size_t col, std::size_t ...row> constexpr Vector<rows, T> valueOrIdentityVector(Containers::Implementation::Sequence<row...>, const RectangularMatrix<otherCols, otherRows, T>& other, T value) {
return {(col < otherCols && row < otherRows ? other[col][row] :
col == row ? value : T{0})...};
}
template<std::size_t cols, std::size_t rows, std::size_t otherCols, std::size_t otherRows, class T, std::size_t col> constexpr Vector<rows, T> valueOrIdentityVector(const RectangularMatrix<otherCols, otherRows, T>& other, T value) {
return valueOrIdentityVector<cols, rows, otherCols, otherRows, T, col>(typename Corrade::Containers::Implementation::GenerateSequence<rows>::Type{}, other, value);
return valueOrIdentityVector<cols, rows, otherCols, otherRows, T, col>(typename Containers::Implementation::GenerateSequence<rows>::Type{}, other, value);
}
}
@ -131,7 +131,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* @see @ref diagonal()
*/
constexpr static RectangularMatrix<cols, rows, T> fromDiagonal(const Vector<DiagonalSize, T>& diagonal) noexcept {
return RectangularMatrix(typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{}, diagonal);
return RectangularMatrix(typename Containers::Implementation::GenerateSequence<cols>::Type{}, diagonal);
}
/**
@ -139,14 +139,14 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
*
* Equivalent to @ref RectangularMatrix(ZeroInitT).
*/
constexpr /*implicit*/ RectangularMatrix() noexcept: RectangularMatrix<cols, rows, T>{typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{}, ZeroInit} {}
constexpr /*implicit*/ RectangularMatrix() noexcept: RectangularMatrix<cols, rows, T>{typename Containers::Implementation::GenerateSequence<cols>::Type{}, ZeroInit} {}
/**
* @brief Construct a zero-filled matrix
*
* @see @ref RectangularMatrix(IdentityInitT, T)
*/
constexpr explicit RectangularMatrix(ZeroInitT) noexcept: RectangularMatrix<cols, rows, T>{typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{}, ZeroInit} {}
constexpr explicit RectangularMatrix(ZeroInitT) noexcept: RectangularMatrix<cols, rows, T>{typename Containers::Implementation::GenerateSequence<cols>::Type{}, ZeroInit} {}
/**
* @brief Construct an identity matrix
@ -156,10 +156,10 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* elements. The @p value allows you to specify a value on diagonal.
* @see @ref RectangularMatrix(ZeroInitT), @ref fromDiagonal()
*/
constexpr explicit RectangularMatrix(IdentityInitT, T value = T(1)) noexcept: RectangularMatrix<cols, rows, T>{typename Corrade::Containers::Implementation::GenerateSequence<DiagonalSize>::Type{}, Vector<DiagonalSize, T>(value)} {}
constexpr explicit RectangularMatrix(IdentityInitT, T value = T(1)) noexcept: RectangularMatrix<cols, rows, T>{typename Containers::Implementation::GenerateSequence<DiagonalSize>::Type{}, Vector<DiagonalSize, T>(value)} {}
/** @brief Construct without initializing the contents */
explicit RectangularMatrix(Magnum::NoInitT) noexcept: RectangularMatrix<cols, rows, T>{typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{}, Magnum::NoInit} {}
explicit RectangularMatrix(Magnum::NoInitT) noexcept: RectangularMatrix<cols, rows, T>{typename Containers::Implementation::GenerateSequence<cols>::Type{}, Magnum::NoInit} {}
/** @brief Construct from column vectors */
template<class ...U> constexpr /*implicit*/ RectangularMatrix(const Vector<rows, T>& first, const U&... next) noexcept: _data{first, next...} {
@ -167,7 +167,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
}
/** @brief Construct with one value for all components */
constexpr explicit RectangularMatrix(T value) noexcept: RectangularMatrix{typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{}, value} {}
constexpr explicit RectangularMatrix(T value) noexcept: RectangularMatrix{typename Containers::Implementation::GenerateSequence<cols>::Type{}, value} {}
/**
* @brief Construct from a matrix of a different type
@ -177,7 +177,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
*
* @snippet MagnumMath.cpp RectangularMatrix-conversion
*/
template<class U> constexpr explicit RectangularMatrix(const RectangularMatrix<cols, rows, U>& other) noexcept: RectangularMatrix(typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{}, other) {}
template<class U> constexpr explicit RectangularMatrix(const RectangularMatrix<cols, rows, U>& other) noexcept: RectangularMatrix(typename Containers::Implementation::GenerateSequence<cols>::Type{}, other) {}
/**
* @brief Construct by slicing or expanding a matrix of different size, leaving the rest at zero
@ -186,7 +186,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* If the other matrix has less columns or rows, the corresponding
* vectors and components are set to zeros.
*/
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit RectangularMatrix(ZeroInitT, const RectangularMatrix<otherCols, otherRows, T>& other) noexcept: RectangularMatrix<cols, rows, T>{ZeroInit, typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{}, other} {}
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit RectangularMatrix(ZeroInitT, const RectangularMatrix<otherCols, otherRows, T>& other) noexcept: RectangularMatrix<cols, rows, T>{ZeroInit, typename Containers::Implementation::GenerateSequence<cols>::Type{}, other} {}
/**
* @brief Construct by slicing or expanding a matrix of different size, leaving the rest at identity
@ -196,7 +196,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* vectors and components are set to either zeros or @p value on the
* diagonal.
*/
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit RectangularMatrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>& other, T value = T(1)) noexcept: RectangularMatrix<cols, rows, T>{IdentityInit, typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{}, other, value} {}
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit RectangularMatrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>& other, T value = T(1)) noexcept: RectangularMatrix<cols, rows, T>{IdentityInit, typename Containers::Implementation::GenerateSequence<cols>::Type{}, other, value} {}
/**
* @brief Construct by slicing or expanding a matrix of different size
@ -206,7 +206,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* Note that this default is different from @ref Matrix, where it's
* equivalent to the @ref IdentityInit variant instead.
*/
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit RectangularMatrix(const RectangularMatrix<otherCols, otherRows, T>& other) noexcept: RectangularMatrix<cols, rows, T>{ZeroInit, typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{}, other} {}
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit RectangularMatrix(const RectangularMatrix<otherCols, otherRows, T>& other) noexcept: RectangularMatrix<cols, rows, T>{ZeroInit, typename Containers::Implementation::GenerateSequence<cols>::Type{}, other} {}
/** @brief Construct a matrix from external representation */
template<class U, class V = decltype(Implementation::RectangularMatrixConverter<cols, rows, T, U>::from(std::declval<U>()))> constexpr explicit RectangularMatrix(const U& other): RectangularMatrix(Implementation::RectangularMatrixConverter<cols, rows, T, U>::from(other)) {}
@ -484,7 +484,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* @see @ref transposed(), @ref flippedRows(), @ref Vector::flipped()
*/
constexpr RectangularMatrix<cols, rows, T> flippedCols() const {
return flippedColsInternal(typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{});
return flippedColsInternal(typename Containers::Implementation::GenerateSequence<cols>::Type{});
}
/**
@ -494,7 +494,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* @see @ref transposed(), @ref flippedCols(), @ref Vector::flipped()
*/
constexpr RectangularMatrix<cols, rows, T> flippedRows() const {
return flippedRowsInternal(typename Corrade::Containers::Implementation::GenerateSequence<cols>::Type{});
return flippedRowsInternal(typename Containers::Implementation::GenerateSequence<cols>::Type{});
}
/**
@ -506,7 +506,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
/* NVCC (from CUDA) has problems compiling this function under
Windows when there's a separate definition due to DiagonalSize
(see https://github.com/mosra/magnum/issues/345 for details) */
return diagonalInternal(typename Corrade::Containers::Implementation::GenerateSequence<DiagonalSize>::Type{});
return diagonalInternal(typename Containers::Implementation::GenerateSequence<DiagonalSize>::Type{});
}
/**
@ -530,33 +530,33 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
/* Implementation for RectangularMatrix<cols, rows, T>::RectangularMatrix(T) and Matrix<size, T>(T) */
/* MSVC 2015 can't handle {} here */
template<std::size_t ...sequence> constexpr explicit RectangularMatrix(Corrade::Containers::Implementation::Sequence<sequence...>, T value) noexcept: _data{Vector<rows, T>((static_cast<void>(sequence), value))...} {}
template<std::size_t ...sequence> constexpr explicit RectangularMatrix(Containers::Implementation::Sequence<sequence...>, T value) noexcept: _data{Vector<rows, T>((static_cast<void>(sequence), value))...} {}
/* Implementation for RectangularMatrix<cols, rows, T>::fromDiagonal() and RectangularMatrix<cols, rows, T>(IdentityInitT, T) */
template<std::size_t ...sequence> constexpr explicit RectangularMatrix(Corrade::Containers::Implementation::Sequence<sequence...>, const Vector<DiagonalSize, T>& diagonal);
template<std::size_t ...sequence> constexpr explicit RectangularMatrix(Containers::Implementation::Sequence<sequence...>, const Vector<DiagonalSize, T>& diagonal);
/* Implementation for RectangularMatrix<cols, rows, T>::RectangularMatrix(const RectangularMatrix<cols, rows, U>&) */
template<class U, std::size_t ...sequence> constexpr explicit RectangularMatrix(Corrade::Containers::Implementation::Sequence<sequence...>, const RectangularMatrix<cols, rows, U>& matrix) noexcept: _data{Vector<rows, T>(matrix[sequence])...} {}
template<class U, std::size_t ...sequence> constexpr explicit RectangularMatrix(Containers::Implementation::Sequence<sequence...>, const RectangularMatrix<cols, rows, U>& matrix) noexcept: _data{Vector<rows, T>(matrix[sequence])...} {}
/* Implementation for RectangularMatrix<cols, rows, T>::RectangularMatrix(ZeroInitT, const RectangularMatrix<otherCols, otherRows, T>&) */
template<std::size_t otherCols, std::size_t otherRows, std::size_t ...col> constexpr explicit RectangularMatrix(ZeroInitT, Corrade::Containers::Implementation::Sequence<col...>, const RectangularMatrix<otherCols, otherRows, T>& other) noexcept: RectangularMatrix<cols, rows, T>{Implementation::valueOrZeroVector<cols, rows, otherCols, otherRows, T, col>(other)...} {}
template<std::size_t otherCols, std::size_t otherRows, std::size_t ...col> constexpr explicit RectangularMatrix(ZeroInitT, Containers::Implementation::Sequence<col...>, const RectangularMatrix<otherCols, otherRows, T>& other) noexcept: RectangularMatrix<cols, rows, T>{Implementation::valueOrZeroVector<cols, rows, otherCols, otherRows, T, col>(other)...} {}
/* Implementation for RectangularMatrix<cols, rows, T>::RectangularMatrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>&) */
template<std::size_t otherCols, std::size_t otherRows, std::size_t ...col> constexpr explicit RectangularMatrix(IdentityInitT, Corrade::Containers::Implementation::Sequence<col...>, const RectangularMatrix<otherCols, otherRows, T>& other, T value) noexcept: RectangularMatrix<cols, rows, T>{Implementation::valueOrIdentityVector<cols, rows, otherCols, otherRows, T, col>(other, value)...} {}
template<std::size_t otherCols, std::size_t otherRows, std::size_t ...col> constexpr explicit RectangularMatrix(IdentityInitT, Containers::Implementation::Sequence<col...>, const RectangularMatrix<otherCols, otherRows, T>& other, T value) noexcept: RectangularMatrix<cols, rows, T>{Implementation::valueOrIdentityVector<cols, rows, otherCols, otherRows, T, col>(other, value)...} {}
/* Implementation for RectangularMatrix<cols, rows, T>::RectangularMatrix(ZeroInitT) and RectangularMatrix<cols, rows, T>::RectangularMatrix(NoInitT) */
/* MSVC 2015 can't handle {} here */
template<class U, std::size_t ...sequence> constexpr explicit RectangularMatrix(Corrade::Containers::Implementation::Sequence<sequence...>, U) noexcept: _data{Vector<rows, T>((static_cast<void>(sequence), U{typename U::Init{}}))...} {}
template<class U, std::size_t ...sequence> constexpr explicit RectangularMatrix(Containers::Implementation::Sequence<sequence...>, U) noexcept: _data{Vector<rows, T>((static_cast<void>(sequence), U{typename U::Init{}}))...} {}
template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T> flippedColsInternal(Corrade::Containers::Implementation::Sequence<sequence...>) const {
template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T> flippedColsInternal(Containers::Implementation::Sequence<sequence...>) const {
return {_data[cols - 1 - sequence]...};
}
template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T> flippedRowsInternal(Corrade::Containers::Implementation::Sequence<sequence...>) const {
template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T> flippedRowsInternal(Containers::Implementation::Sequence<sequence...>) const {
return {_data[sequence].flipped()...};
}
template<std::size_t ...sequence> constexpr Vector<DiagonalSize, T> diagonalInternal(Corrade::Containers::Implementation::Sequence<sequence...>) const;
template<std::size_t ...sequence> constexpr Vector<DiagonalSize, T> diagonalInternal(Containers::Implementation::Sequence<sequence...>) const;
Vector<rows, T> _data[cols];
};
@ -687,44 +687,44 @@ template<std::size_t size, std::size_t cols, class T> inline RectangularMatrix<c
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{RectangularMatrix} */
template<std::size_t cols, std::size_t rows, class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Magnum::Math::RectangularMatrix<cols, rows, T>& value) {
template<std::size_t cols, std::size_t rows, class T> Debug& operator<<(Debug& debug, const Magnum::Math::RectangularMatrix<cols, rows, T>& value) {
/** @todo might make sense to propagate the flags also, for hex value
printing etc */
const bool packed = debug.immediateFlags() >= Corrade::Utility::Debug::Flag::Packed;
debug << (packed ? "{" : "Matrix(") << Corrade::Utility::Debug::nospace;
const bool packed = debug.immediateFlags() >= Debug::Flag::Packed;
debug << (packed ? "{" : "Matrix(") << Debug::nospace;
for(std::size_t row = 0; row != rows; ++row) {
if(row != 0) debug << Corrade::Utility::Debug::nospace << (packed ? ",\n" : ",\n ");
if(row != 0) debug << Debug::nospace << (packed ? ",\n" : ",\n ");
for(std::size_t col = 0; col != cols; ++col) {
if(col != 0) debug << Corrade::Utility::Debug::nospace << ",";
if(col != 0) debug << Debug::nospace << ",";
debug << value[col][row];
}
}
return debug << Corrade::Utility::Debug::nospace << (packed ? "}" : ")");
return debug << Debug::nospace << (packed ? "}" : ")");
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
/* Square matrices */
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 2, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 3, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 4, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 2, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 3, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 4, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<2, 2, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<3, 3, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<4, 4, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<2, 2, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<3, 3, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<4, 4, Double>&);
/* Rectangular matrices */
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 3, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 2, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 4, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 2, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 4, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 3, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 3, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 2, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 4, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 2, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 4, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 3, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<2, 3, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<3, 2, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<2, 4, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<4, 2, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<3, 4, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<4, 3, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<2, 3, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<3, 2, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<2, 4, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<4, 2, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<3, 4, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const RectangularMatrix<4, 3, Double>&);
#endif
#endif
@ -805,15 +805,15 @@ extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utili
#endif
namespace Implementation {
template<std::size_t rows, std::size_t i, class T, std::size_t ...sequence> constexpr Vector<rows, T> diagonalMatrixColumn2(Corrade::Containers::Implementation::Sequence<sequence...>, const T& number) {
template<std::size_t rows, std::size_t i, class T, std::size_t ...sequence> constexpr Vector<rows, T> diagonalMatrixColumn2(Containers::Implementation::Sequence<sequence...>, const T& number) {
return {(sequence == i ? number : T(0))...};
}
template<std::size_t rows, std::size_t i, class T> constexpr Vector<rows, T> diagonalMatrixColumn(const T& number) {
return diagonalMatrixColumn2<rows, i, T>(typename Corrade::Containers::Implementation::GenerateSequence<rows>::Type{}, number);
return diagonalMatrixColumn2<rows, i, T>(typename Containers::Implementation::GenerateSequence<rows>::Type{}, number);
}
}
template<std::size_t cols, std::size_t rows, class T> template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T>::RectangularMatrix(Corrade::Containers::Implementation::Sequence<sequence...>, const Vector<DiagonalSize, T>& diagonal): _data{Implementation::diagonalMatrixColumn<rows, sequence>(sequence < DiagonalSize ? diagonal[sequence] : T{})...} {}
template<std::size_t cols, std::size_t rows, class T> template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T>::RectangularMatrix(Containers::Implementation::Sequence<sequence...>, const Vector<DiagonalSize, T>& diagonal): _data{Implementation::diagonalMatrixColumn<rows, sequence>(sequence < DiagonalSize ? diagonal[sequence] : T{})...} {}
template<std::size_t cols, std::size_t rows, class T> inline Vector<cols, T> RectangularMatrix<cols, rows, T>::row(std::size_t row) const {
Vector<cols, T> out;
@ -868,7 +868,7 @@ template<std::size_t cols, std::size_t rows, class T> inline RectangularMatrix<r
}
#ifndef DOXYGEN_GENERATING_OUTPUT
template<std::size_t cols, std::size_t rows, class T> template<std::size_t ...sequence> constexpr auto RectangularMatrix<cols, rows, T>::diagonalInternal(Corrade::Containers::Implementation::Sequence<sequence...>) const -> Vector<DiagonalSize, T> {
template<std::size_t cols, std::size_t rows, class T> template<std::size_t ...sequence> constexpr auto RectangularMatrix<cols, rows, T>::diagonalInternal(Containers::Implementation::Sequence<sequence...>) const -> Vector<DiagonalSize, T> {
return {_data[sequence][sequence]...};
}
#endif

4
src/Magnum/Math/Swizzle.h

@ -90,7 +90,7 @@ namespace Implementation {
template<std::size_t size> struct ScatterComponent<size, 'b', 2>: ScatterComponentOr<size, 2> {};
template<std::size_t size> struct ScatterComponent<size, 'a', 3>: ScatterComponentOr<size, 3> {};
template<class T, char component, std::size_t ...sequence> constexpr T scatterComponentOr(const T& vector, const typename T::Type& value, Corrade::Containers::Implementation::Sequence<sequence...>) {
template<class T, char component, std::size_t ...sequence> constexpr T scatterComponentOr(const T& vector, const typename T::Type& value, Containers::Implementation::Sequence<sequence...>) {
return {ScatterComponent<T::Size, component, sequence>::value(vector, value)...};
}
template<class T, std::size_t valueSize> constexpr T scatterRecursive(const T& vector, const Vector<valueSize, typename T::Type>&, std::size_t) {
@ -98,7 +98,7 @@ namespace Implementation {
}
template<class T, std::size_t valueSize, char component, char ...next> constexpr T scatterRecursive(const T& vector, const Vector<valueSize, typename T::Type>& values, std::size_t valueIndex) {
return scatterRecursive<T, valueSize, next...>(
scatterComponentOr<T, component>(vector, values._data[valueIndex], typename Corrade::Containers::Implementation::GenerateSequence<T::Size>::Type{}),
scatterComponentOr<T, component>(vector, values._data[valueIndex], typename Containers::Implementation::GenerateSequence<T::Size>::Type{}),
values, valueIndex + 1);
}
}

24
src/Magnum/Math/Test/AngleTest.cpp

@ -39,7 +39,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct AngleTest: Corrade::TestSuite::Tester {
struct AngleTest: TestSuite::Tester {
explicit AngleTest();
void construct();
@ -84,16 +84,16 @@ constexpr struct {
constexpr struct {
const char* name;
const char* data;
Corrade::Utility::TweakableState state;
Utility::TweakableState state;
const char* error;
} TweakableErrorData[] {
{"empty", "", Corrade::Utility::TweakableState::Recompile,
{"empty", "", Utility::TweakableState::Recompile,
"Utility::TweakableParser: is not an angle literal\n"},
{"integral", "42_{}", Corrade::Utility::TweakableState::Recompile,
{"integral", "42_{}", Utility::TweakableState::Recompile,
"Utility::TweakableParser: 42_{} is not an angle literal\n"},
{"garbage after", "42.b_{}", Corrade::Utility::TweakableState::Recompile,
{"garbage after", "42.b_{}", Utility::TweakableState::Recompile,
"Utility::TweakableParser: unexpected characters b_{} after an angle literal\n"},
{"different suffix", "42.0u", Corrade::Utility::TweakableState::Recompile, /* not for double */
{"different suffix", "42.0u", Utility::TweakableState::Recompile, /* not for double */
"Utility::TweakableParser: 42.0u has an unexpected suffix, expected _{}\n"}
};
@ -157,7 +157,7 @@ AngleTest::AngleTest() {
&AngleTest::tweakable<Unit<Math::Rad, Float>>,
&AngleTest::tweakable<Radd>,
&AngleTest::tweakable<Unit<Math::Rad, Double>>},
Corrade::Containers::arraySize(TweakableData));
Containers::arraySize(TweakableData));
addInstancedTests<AngleTest>({
&AngleTest::tweakableError<Deg>,
@ -168,7 +168,7 @@ AngleTest::AngleTest() {
&AngleTest::tweakableError<Unit<Math::Rad, Float>>,
&AngleTest::tweakableError<Radd>,
&AngleTest::tweakableError<Unit<Math::Rad, Double>>},
Corrade::Containers::arraySize(TweakableErrorData));
Containers::arraySize(TweakableErrorData));
#endif
}
@ -351,8 +351,8 @@ template<class T> void AngleTest::tweakable() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseTemplateName(TweakableTraits<T>::name());
setTestCaseDescription(data.name);
auto result = Corrade::Utility::TweakableParser<T>::parse(Corrade::Utility::format(data.data, TweakableTraits<T>::literal()));
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
auto result = Utility::TweakableParser<T>::parse(Utility::format(data.data, TweakableTraits<T>::literal()));
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), T(typename T::Type(data.result)));
}
@ -364,8 +364,8 @@ template<class T> void AngleTest::tweakableError() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<T>::parse(Corrade::Utility::format(data.data, TweakableTraits<T>::literal())).first();
CORRADE_COMPARE(out.str(), Corrade::Utility::formatString(data.error, TweakableTraits<T>::literal()));
Utility::TweakableState state = Utility::TweakableParser<T>::parse(Utility::format(data.data, TweakableTraits<T>::literal())).first();
CORRADE_COMPARE(out.str(), Utility::formatString(data.error, TweakableTraits<T>::literal()));
CORRADE_COMPARE(state, data.state);
}
#endif

6
src/Magnum/Math/Test/BezierTest.cpp

@ -64,7 +64,7 @@ typedef Math::QuadraticBezier2D<Double> QuadraticBezier2Dd;
typedef Math::CubicBezier2D<Float> CubicBezier2D;
typedef Math::CubicHermite2D<Float> CubicHermite2D;
struct BezierTest: Corrade::TestSuite::Tester {
struct BezierTest: TestSuite::Tester {
explicit BezierTest();
void construct();
@ -248,8 +248,8 @@ void BezierTest::data() {
CORRADE_COMPARE(d, (Vector2{3.5f, 0.1f}));
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 3);
CORRADE_COMPARE(Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 3);
}
void BezierTest::compare() {

6
src/Magnum/Math/Test/BitVectorTest.cpp

@ -52,7 +52,7 @@ template<> struct BitVectorConverter<3, BVec3> {
namespace Test { namespace {
struct BitVectorTest: Corrade::TestSuite::Tester {
struct BitVectorTest: TestSuite::Tester {
explicit BitVectorTest();
void construct();
@ -242,8 +242,8 @@ void BitVectorTest::data() {
CORRADE_COMPARE(c, 0x08);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a1.data()), 3);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 3);
CORRADE_COMPARE(Containers::arraySize(a1.data()), 3);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 3);
}
void BitVectorTest::compare() {

12
src/Magnum/Math/Test/ColorBatchTest.cpp

@ -47,7 +47,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct ColorBatchTest: Corrade::TestSuite::Tester {
struct ColorBatchTest: TestSuite::Tester {
explicit ColorBatchTest();
void yFlip();
@ -296,7 +296,7 @@ void ColorBatchTest::yFlip() {
setTestCaseDescription(data.name);
/* Copy to a mutable array first to operate in-place */
Containers::Array<char> blocks{Corrade::NoInit, data.input.size()};
Containers::Array<char> blocks{Magnum::NoInit, data.input.size()};
Utility::copy(data.input, blocks);
/* Using expanded() instead of the constructor as it catches issues where
the size would be smaller than the actual data */
@ -323,22 +323,22 @@ void ColorBatchTest::yFlip() {
if(decoded->format() == PixelFormat::RGBA8Unorm)
CORRADE_COMPARE_WITH(decoded->pixels<Vector4ub>().flipped<0>(),
Corrade::Utility::Path::join(COLORBATCH_TEST_DIR, data.file),
Utility::Path::join(COLORBATCH_TEST_DIR, data.file),
(DebugTools::CompareImageToFile{_importerManager, _converterManager}));
else if(decoded->format() == PixelFormat::RG8Unorm)
CORRADE_COMPARE_WITH(decoded->pixels<Vector2ub>().flipped<0>(),
Corrade::Utility::Path::join(COLORBATCH_TEST_DIR, data.file),
Utility::Path::join(COLORBATCH_TEST_DIR, data.file),
(DebugTools::CompareImageToFile{_importerManager, _converterManager}));
else if(decoded->format() == PixelFormat::R8Unorm)
CORRADE_COMPARE_WITH(decoded->pixels<UnsignedByte>().flipped<0>(),
Corrade::Utility::Path::join(COLORBATCH_TEST_DIR, data.file),
Utility::Path::join(COLORBATCH_TEST_DIR, data.file),
(DebugTools::CompareImageToFile{_importerManager, _converterManager}));
else CORRADE_FAIL("Unexpected format" << decoded->format());
}
void ColorBatchTest::yFlip3D() {
/* Copy to a mutable array first to operate in-place */
Containers::Array<char> blocks{Corrade::NoInit, Containers::arraySize(CheckerboardBC1)};
Containers::Array<char> blocks{Magnum::NoInit, Containers::arraySize(CheckerboardBC1)};
Utility::copy(CheckerboardBC1, blocks);
/* The 2D 4x6 blocks image is turned into 4 slices of 1x6 blocks each.

90
src/Magnum/Math/Test/ColorTest.cpp

@ -74,7 +74,7 @@ template<> struct VectorConverter<4, float, Vec4> {
namespace Test { namespace {
struct ColorTest: Corrade::TestSuite::Tester {
struct ColorTest: TestSuite::Tester {
explicit ColorTest();
void construct();
@ -193,20 +193,20 @@ const struct {
constexpr struct {
const char* name;
const char* data;
Corrade::Utility::TweakableState state;
Utility::TweakableState state;
const char* error;
} TweakableErrorData[] {
{"empty", "", Corrade::Utility::TweakableState::Recompile,
{"empty", "", Utility::TweakableState::Recompile,
"Utility::TweakableParser: is not a hexadecimal color literal\n"},
{"char", "'a'", Corrade::Utility::TweakableState::Recompile,
{"char", "'a'", Utility::TweakableState::Recompile,
"Utility::TweakableParser: 'a' is not a hexadecimal color literal\n"},
{"not hex", "{}_{}", Corrade::Utility::TweakableState::Recompile,
{"not hex", "{}_{}", Utility::TweakableState::Recompile,
"Utility::TweakableParser: {0}_{2}{1} is not a hexadecimal color literal\n"},
{"garbage after", "0x{}._{}", Corrade::Utility::TweakableState::Recompile,
{"garbage after", "0x{}._{}", Utility::TweakableState::Recompile,
"Utility::TweakableParser: unexpected characters ._{2}{1} after a color literal\n"},
{"different suffix", "0x{}f", Corrade::Utility::TweakableState::Recompile,
{"different suffix", "0x{}f", Utility::TweakableState::Recompile,
"Utility::TweakableParser: 0x{0}f has an unexpected suffix, expected _{1} or _s{1}\n"},
{"bad size", "0x333_{1}", Corrade::Utility::TweakableState::Error,
{"bad size", "0x333_{1}", Utility::TweakableState::Error,
"Utility::TweakableParser: 0x333_{2}{1} doesn't have expected number of digits\n"},
};
#endif
@ -280,7 +280,7 @@ ColorTest::ColorTest() {
&ColorTest::tweakableSrgbf,
&ColorTest::tweakableRgbaf,
&ColorTest::tweakableSrgbaf},
Corrade::Containers::arraySize(TweakableData));
Containers::arraySize(TweakableData));
addInstancedTests({&ColorTest::tweakableErrorRgb,
&ColorTest::tweakableErrorSrgb,
@ -290,7 +290,7 @@ ColorTest::ColorTest() {
&ColorTest::tweakableErrorSrgbf,
&ColorTest::tweakableErrorRgbaf,
&ColorTest::tweakableErrorSrgbaf},
Corrade::Containers::arraySize(TweakableErrorData));
Containers::arraySize(TweakableErrorData));
#endif
}
@ -973,8 +973,8 @@ void ColorTest::integralLinearRgbToIntegral() {
void ColorTest::srgbMonotonic() {
Color3 rgbPrevious = Color3::fromSrgb(Vector3us(testCaseRepeatId()));
Color3 rgb = Color3::fromSrgb(Vector3us(testCaseRepeatId() + 1));
CORRADE_COMPARE_AS(rgb, rgbPrevious, Corrade::TestSuite::Compare::Greater);
CORRADE_COMPARE_AS(rgb, Color3(0.0f), Corrade::TestSuite::Compare::GreaterOrEqual);
CORRADE_COMPARE_AS(rgb, rgbPrevious, TestSuite::Compare::Greater);
CORRADE_COMPARE_AS(rgb, Color3(0.0f), TestSuite::Compare::GreaterOrEqual);
{
#ifdef CORRADE_TARGET_EMSCRIPTEN
CORRADE_EXPECT_FAIL_IF(testCaseRepeatId() == 65534 && !!(rgb > Color3(1.0f)),
@ -982,7 +982,7 @@ void ColorTest::srgbMonotonic() {
"optimizations. Happens only on larger optimization levels, not "
"on -O1.");
#endif
CORRADE_COMPARE_AS(rgb, Color3(1.0f), Corrade::TestSuite::Compare::LessOrEqual);
CORRADE_COMPARE_AS(rgb, Color3(1.0f), TestSuite::Compare::LessOrEqual);
}
}
@ -1187,8 +1187,8 @@ void ColorTest::tweakableRgb() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name);
Corrade::Containers::Pair<Corrade::Utility::TweakableState, Color3ub> result = Corrade::Utility::TweakableParser<Color3ub>::parse(Corrade::Utility::format(data.dataRgb, "rgb"));
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
Containers::Pair<Utility::TweakableState, Color3ub> result = Utility::TweakableParser<Color3ub>::parse(Utility::format(data.dataRgb, "rgb"));
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), data.resultUb.rgb());
}
@ -1196,8 +1196,8 @@ void ColorTest::tweakableSrgb() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name);
Corrade::Containers::Pair<Corrade::Utility::TweakableState, Color3ub> result = Corrade::Utility::TweakableParser<Vector3ub>::parse(Corrade::Utility::format(data.dataRgb, "srgb"));
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
Containers::Pair<Utility::TweakableState, Color3ub> result = Utility::TweakableParser<Vector3ub>::parse(Utility::format(data.dataRgb, "srgb"));
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), data.resultUb.rgb());
}
@ -1205,8 +1205,8 @@ void ColorTest::tweakableRgba() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name);
Corrade::Containers::Pair<Corrade::Utility::TweakableState, Color4ub> result = Corrade::Utility::TweakableParser<Color4ub>::parse(Corrade::Utility::format(data.dataRgba, "rgba"));
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
Containers::Pair<Utility::TweakableState, Color4ub> result = Utility::TweakableParser<Color4ub>::parse(Utility::format(data.dataRgba, "rgba"));
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), data.resultUb);
}
@ -1214,8 +1214,8 @@ void ColorTest::tweakableSrgba() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name);
Corrade::Containers::Pair<Corrade::Utility::TweakableState, Color4ub> result = Corrade::Utility::TweakableParser<Vector4ub>::parse(Corrade::Utility::format(data.dataRgba, "srgba"));
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
Containers::Pair<Utility::TweakableState, Color4ub> result = Utility::TweakableParser<Vector4ub>::parse(Utility::format(data.dataRgba, "srgba"));
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), data.resultUb);
}
@ -1223,8 +1223,8 @@ void ColorTest::tweakableRgbf() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name);
Corrade::Containers::Pair<Corrade::Utility::TweakableState, Color3> result = Corrade::Utility::TweakableParser<Color3>::parse(Corrade::Utility::format(data.dataRgb, "rgbf"));
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
Containers::Pair<Utility::TweakableState, Color3> result = Utility::TweakableParser<Color3>::parse(Utility::format(data.dataRgb, "rgbf"));
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), data.result.rgb());
}
@ -1232,8 +1232,8 @@ void ColorTest::tweakableSrgbf() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name);
Corrade::Containers::Pair<Corrade::Utility::TweakableState, Color3> result = Corrade::Utility::TweakableParser<Color3>::parse(Corrade::Utility::format(data.dataRgb, "srgbf"));
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
Containers::Pair<Utility::TweakableState, Color3> result = Utility::TweakableParser<Color3>::parse(Utility::format(data.dataRgb, "srgbf"));
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), data.resultSrgba.rgb());
}
@ -1241,8 +1241,8 @@ void ColorTest::tweakableRgbaf() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name);
Corrade::Containers::Pair<Corrade::Utility::TweakableState, Color4> result = Corrade::Utility::TweakableParser<Color4>::parse(Corrade::Utility::format(data.dataRgba, "rgbaf"));
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
Containers::Pair<Utility::TweakableState, Color4> result = Utility::TweakableParser<Color4>::parse(Utility::format(data.dataRgba, "rgbaf"));
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), data.result);
}
@ -1250,8 +1250,8 @@ void ColorTest::tweakableSrgbaf() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name);
Corrade::Containers::Pair<Corrade::Utility::TweakableState, Color4> result = Corrade::Utility::TweakableParser<Color4>::parse(Corrade::Utility::format(data.dataRgba, "srgbaf"));
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
Containers::Pair<Utility::TweakableState, Color4> result = Utility::TweakableParser<Color4>::parse(Utility::format(data.dataRgba, "srgbaf"));
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), data.resultSrgba);
}
@ -1262,8 +1262,8 @@ void ColorTest::tweakableErrorRgb() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Color3ub>::parse(Corrade::Utility::format(data.data, "ff3366", "rgb")).first();
CORRADE_COMPARE(out.str(), Corrade::Utility::formatString(data.error, "ff3366", "rgb", ""));
Utility::TweakableState state = Utility::TweakableParser<Color3ub>::parse(Utility::format(data.data, "ff3366", "rgb")).first();
CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366", "rgb", ""));
CORRADE_COMPARE(state, data.state);
}
@ -1274,8 +1274,8 @@ void ColorTest::tweakableErrorSrgb() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Vector3ub>::parse(Corrade::Utility::format(data.data, "ff3366", "srgb")).first();
CORRADE_COMPARE(out.str(), Corrade::Utility::formatString(data.error, "ff3366", "rgb", "s"));
Utility::TweakableState state = Utility::TweakableParser<Vector3ub>::parse(Utility::format(data.data, "ff3366", "srgb")).first();
CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366", "rgb", "s"));
CORRADE_COMPARE(state, data.state);
}
@ -1286,8 +1286,8 @@ void ColorTest::tweakableErrorRgba() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Color4ub>::parse(Corrade::Utility::format(data.data, "ff3366aa", "rgba")).first();
CORRADE_COMPARE(out.str(), Corrade::Utility::formatString(data.error, "ff3366aa", "rgba", ""));
Utility::TweakableState state = Utility::TweakableParser<Color4ub>::parse(Utility::format(data.data, "ff3366aa", "rgba")).first();
CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366aa", "rgba", ""));
CORRADE_COMPARE(state, data.state);
}
@ -1298,8 +1298,8 @@ void ColorTest::tweakableErrorSrgba() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Vector4ub>::parse(Corrade::Utility::format(data.data, "ff3366aa", "srgba")).first();
CORRADE_COMPARE(out.str(), Corrade::Utility::formatString(data.error, "ff3366aa", "rgba", "s"));
Utility::TweakableState state = Utility::TweakableParser<Vector4ub>::parse(Utility::format(data.data, "ff3366aa", "srgba")).first();
CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366aa", "rgba", "s"));
CORRADE_COMPARE(state, data.state);
}
@ -1310,8 +1310,8 @@ void ColorTest::tweakableErrorRgbf() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Color3>::parse(Corrade::Utility::format(data.data, "ff3366", "rgbf")).first();
CORRADE_COMPARE(out.str(), Corrade::Utility::formatString(data.error, "ff3366", "rgbf", ""));
Utility::TweakableState state = Utility::TweakableParser<Color3>::parse(Utility::format(data.data, "ff3366", "rgbf")).first();
CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366", "rgbf", ""));
CORRADE_COMPARE(state, data.state);
}
@ -1322,8 +1322,8 @@ void ColorTest::tweakableErrorSrgbf() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Color3>::parse(Corrade::Utility::format(data.data, "ff3366", "srgbf")).first();
CORRADE_COMPARE(out.str(), Corrade::Utility::formatString(data.error, "ff3366", "rgbf", "s"));
Utility::TweakableState state = Utility::TweakableParser<Color3>::parse(Utility::format(data.data, "ff3366", "srgbf")).first();
CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366", "rgbf", "s"));
CORRADE_COMPARE(state, data.state);
}
@ -1334,8 +1334,8 @@ void ColorTest::tweakableErrorRgbaf() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Color4>::parse(Corrade::Utility::format(data.data, "ff3366aa", "rgbaf")).first();
CORRADE_COMPARE(out.str(), Corrade::Utility::formatString(data.error, "ff3366aa", "rgbaf", ""));
Utility::TweakableState state = Utility::TweakableParser<Color4>::parse(Utility::format(data.data, "ff3366aa", "rgbaf")).first();
CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366aa", "rgbaf", ""));
CORRADE_COMPARE(state, data.state);
}
@ -1346,8 +1346,8 @@ void ColorTest::tweakableErrorSrgbaf() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Color4>::parse(Corrade::Utility::format(data.data, "ff3366aa", "srgbaf")).first();
CORRADE_COMPARE(out.str(), Corrade::Utility::formatString(data.error, "ff3366aa", "rgbaf", "s"));
Utility::TweakableState state = Utility::TweakableParser<Color4>::parse(Utility::format(data.data, "ff3366aa", "srgbaf")).first();
CORRADE_COMPARE(out.str(), Utility::formatString(data.error, "ff3366aa", "rgbaf", "s"));
CORRADE_COMPARE(state, data.state);
}
#endif

6
src/Magnum/Math/Test/ComplexTest.cpp

@ -53,7 +53,7 @@ template<> struct ComplexConverter<Float, Cmpl> {
namespace Test { namespace {
struct ComplexTest: Corrade::TestSuite::Tester {
struct ComplexTest: TestSuite::Tester {
explicit ComplexTest();
void construct();
@ -305,8 +305,8 @@ void ComplexTest::data() {
CORRADE_COMPARE(*ca.data(), 1.5f);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 2);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 2);
CORRADE_COMPARE(Containers::arraySize(a.data()), 2);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 2);
}
void ComplexTest::compare() {

36
src/Magnum/Math/Test/ConfigurationValueTest.cpp

@ -31,7 +31,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct ConfigurationValueTest: Corrade::TestSuite::Tester {
struct ConfigurationValueTest: TestSuite::Tester {
explicit ConfigurationValueTest();
void deg();
@ -86,7 +86,7 @@ ConfigurationValueTest::ConfigurationValueTest() {
void ConfigurationValueTest::deg() {
typedef Math::Deg<Float> Deg;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Deg angle{25.3f};
std::string value("25.3");
@ -99,7 +99,7 @@ void ConfigurationValueTest::deg() {
void ConfigurationValueTest::rad() {
typedef Math::Rad<Float> Rad;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Rad angle{3.14159f};
std::string value("3.14159");
@ -112,7 +112,7 @@ void ConfigurationValueTest::rad() {
void ConfigurationValueTest::vector() {
typedef Vector<4, Float> Vector4;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Vector4 vec(3.0f, 3.125f, 9.0f, 9.55f);
std::string value("3 3.125 9 9.55");
@ -133,7 +133,7 @@ void ConfigurationValueTest::vector() {
void ConfigurationValueTest::vector2() {
typedef Math::Vector2<Float> Vector2;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Vector2 vec(3.125f, 9.0f);
std::string value("3.125 9");
@ -146,7 +146,7 @@ void ConfigurationValueTest::vector2() {
void ConfigurationValueTest::vector3() {
typedef Math::Vector3<Float> Vector3;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Vector3 vec(3.0f, 3.125f, 9.55f);
std::string value("3 3.125 9.55");
@ -159,7 +159,7 @@ void ConfigurationValueTest::vector3() {
void ConfigurationValueTest::vector4() {
typedef Math::Vector4<Float> Vector4;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Vector4 vec(3.0f, 3.125f, 9.0f, 9.55f);
std::string value("3 3.125 9 9.55");
@ -173,7 +173,7 @@ void ConfigurationValueTest::color() {
typedef Math::Color3<Float> Color3;
typedef Math::Color4<Float> Color4;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Color3 color3(0.5f, 0.75f, 1.0f);
std::string value3("0.5 0.75 1");
@ -199,7 +199,7 @@ void ConfigurationValueTest::rectangularMatrix() {
Vector4(7.0f, -1.0f, 8.0f, 9.55f));
std::string value("3 4 7 5 4 -1 8 7 8 4 3.125 9.55");
Corrade::Utility::Configuration c;
Utility::Configuration c;
c.setValue<Matrix3x4>("matrix", m);
CORRADE_COMPARE(c.value("matrix"), value);
@ -224,7 +224,7 @@ void ConfigurationValueTest::matrix() {
typedef Math::Vector4<Float> Vector4;
typedef Math::Matrix4x4<Float> Matrix4x4;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Matrix4x4 m(Vector4(3.0f, 5.0f, 8.0f, 4.0f),
Vector4(4.0f, 4.0f, 7.0f, 3.125f),
@ -240,7 +240,7 @@ void ConfigurationValueTest::matrix() {
void ConfigurationValueTest::matrix3() {
typedef Math::Matrix3<Float> Matrix3;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Matrix3 m({5.0f, 8.0f, 4.0f},
{4.0f, 7.0f, 3.125f},
@ -255,7 +255,7 @@ void ConfigurationValueTest::matrix3() {
void ConfigurationValueTest::matrix4() {
typedef Math::Matrix4<Float> Matrix4;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Matrix4 m({3.0f, 5.0f, 8.0f, 4.0f},
{4.0f, 4.0f, 7.0f, 3.125f},
@ -271,7 +271,7 @@ void ConfigurationValueTest::matrix4() {
void ConfigurationValueTest::complex() {
typedef Math::Complex<Float> Complex;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Complex x{3.0f, 3.125f};
std::string value{"3 3.125"};
@ -292,7 +292,7 @@ void ConfigurationValueTest::complex() {
void ConfigurationValueTest::dualComplex() {
typedef Math::DualComplex<Float> DualComplex;
Corrade::Utility::Configuration c;
Utility::Configuration c;
DualComplex a{{3.0f, 3.125f}, {9.0f, 9.55f}};
std::string value("3 3.125 9 9.55");
@ -313,7 +313,7 @@ void ConfigurationValueTest::dualComplex() {
void ConfigurationValueTest::quaternion() {
typedef Math::Quaternion<Float> Quaternion;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Quaternion q{{3.0f, 3.125f, 9.0f}, 9.55f};
std::string value{"3 3.125 9 9.55"};
@ -334,7 +334,7 @@ void ConfigurationValueTest::quaternion() {
void ConfigurationValueTest::dualQuaternion() {
typedef Math::DualQuaternion<Float> DualQuaternion;
Corrade::Utility::Configuration c;
Utility::Configuration c;
DualQuaternion a{{{3.0f, 3.125f, 9.0f}, 9.55f}, {{-1.2f, 0.3f, 1.1f}, 92.05f}};
std::string value{"3 3.125 9 9.55 -1.2 0.3 1.1 92.05"};
@ -355,7 +355,7 @@ void ConfigurationValueTest::dualQuaternion() {
void ConfigurationValueTest::range() {
typedef Math::Range2D<Float> Range2D;
Corrade::Utility::Configuration c;
Utility::Configuration c;
Range2D rect({3.0f, 3.125f}, {9.0f, 9.55f});
std::string value("3 3.125 9 9.55");
@ -369,7 +369,7 @@ void ConfigurationValueTest::bezier() {
typedef Math::Vector2<Float> Vector2;
typedef Math::CubicBezier2D<Float> CubicBezier2D;
Corrade::Utility::Configuration c;
Utility::Configuration c;
CubicBezier2D bezier{Vector2{0.0f, 1.0f}, Vector2{1.5f, -0.3f}, Vector2{2.1f, 0.5f}, Vector2{0.0f, 2.0f}};
std::string value("0 1 1.5 -0.3 2.1 0.5 0 2");

2
src/Magnum/Math/Test/ConstantsTest.cpp

@ -31,7 +31,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct ConstantsTest: Corrade::TestSuite::Tester {
struct ConstantsTest: TestSuite::Tester {
explicit ConstantsTest();
template<class T> void constants();

18
src/Magnum/Math/Test/CubicHermiteTest.cpp

@ -35,7 +35,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct CubicHermiteTest: Corrade::TestSuite::Tester {
struct CubicHermiteTest: TestSuite::Tester {
explicit CubicHermiteTest();
void constructScalar();
@ -677,8 +677,8 @@ void CubicHermiteTest::dataScalar() {
CORRADE_COMPARE(a.data()[2], 2.1f);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 3);
CORRADE_COMPARE(Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 3);
}
void CubicHermiteTest::dataVector() {
@ -702,8 +702,8 @@ void CubicHermiteTest::dataVector() {
CORRADE_COMPARE(*ca.data(), (Vector2{1.0f, 2.0f}));
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 3);
CORRADE_COMPARE(Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 3);
}
void CubicHermiteTest::dataComplex() {
@ -727,8 +727,8 @@ void CubicHermiteTest::dataComplex() {
CORRADE_COMPARE(*ca.data(), (Complex{1.0f, 2.0f}));
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 3);
CORRADE_COMPARE(Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 3);
}
void CubicHermiteTest::dataQuaternion() {
@ -762,8 +762,8 @@ void CubicHermiteTest::dataQuaternion() {
CORRADE_COMPARE(*ca.data(), (Quaternion{{1.0f, 2.0f, -1.0f}, 3.0f}));
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 3);
CORRADE_COMPARE(Containers::arraySize(a.data()), 3);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 3);
}
void CubicHermiteTest::compareScalar() {

2
src/Magnum/Math/Test/DistanceTest.cpp

@ -33,7 +33,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct DistanceTest: Corrade::TestSuite::Tester {
struct DistanceTest: TestSuite::Tester {
explicit DistanceTest();
void pointPoint2D();

6
src/Magnum/Math/Test/DualComplexTest.cpp

@ -54,7 +54,7 @@ template<> struct DualComplexConverter<Float, DualCmpl> {
namespace Test { namespace {
struct DualComplexTest: Corrade::TestSuite::Tester {
struct DualComplexTest: TestSuite::Tester {
explicit DualComplexTest();
void construct();
@ -298,8 +298,8 @@ void DualComplexTest::data() {
CORRADE_COMPARE(a.data()[3], -7.5f);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 4);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 4);
CORRADE_COMPARE(Containers::arraySize(a.data()), 4);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 4);
}
void DualComplexTest::isNormalized() {

6
src/Magnum/Math/Test/DualQuaternionTest.cpp

@ -56,7 +56,7 @@ template<> struct DualQuaternionConverter<Float, DualQuat> {
namespace Test { namespace {
struct DualQuaternionTest: Corrade::TestSuite::Tester {
struct DualQuaternionTest: TestSuite::Tester {
explicit DualQuaternionTest();
void construct();
@ -332,8 +332,8 @@ void DualQuaternionTest::data() {
CORRADE_COMPARE(ca.data()[4], 0.5f);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 8);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 8);
CORRADE_COMPARE(Containers::arraySize(a.data()), 8);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 8);
}
void DualQuaternionTest::isNormalized() {

6
src/Magnum/Math/Test/DualTest.cpp

@ -34,7 +34,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct DualTest: Corrade::TestSuite::Tester {
struct DualTest: TestSuite::Tester {
explicit DualTest();
void construct();
@ -213,8 +213,8 @@ void DualTest::data() {
CORRADE_COMPARE(a.data()[1], -3.5f);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 2);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 2);
CORRADE_COMPARE(Containers::arraySize(a.data()), 2);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 2);
}
void DualTest::compare() {

12
src/Magnum/Math/Test/FrustumTest.cpp

@ -65,7 +65,7 @@ template<> struct FrustumConverter<Float, Frstm> {
namespace Test { namespace {
struct FrustumTest: Corrade::TestSuite::Tester {
struct FrustumTest: TestSuite::Tester {
explicit FrustumTest();
void construct();
@ -303,9 +303,9 @@ void FrustumTest::convert() {
#else
constexpr Frstm d(b);
#endif
CORRADE_COMPARE_AS(Corrade::Containers::arrayView(d.data),
Corrade::Containers::arrayView(a.data),
Corrade::TestSuite::Compare::Container);
CORRADE_COMPARE_AS(Containers::arrayView(d.data),
Containers::arrayView(a.data),
TestSuite::Compare::Container);
/* Implicit conversion is not allowed */
CORRADE_VERIFY(!std::is_convertible<Frstm, Frustum>::value);
@ -348,8 +348,8 @@ void FrustumTest::data() {
CORRADE_COMPARE(ca.data()[4], -1.0f);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 24);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 24);
CORRADE_COMPARE(Containers::arraySize(a.data()), 24);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 24);
}
void FrustumTest::dataOutOfRange() {

18
src/Magnum/Math/Test/FunctionsBatchTest.cpp

@ -33,7 +33,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct FunctionsBatchTest: Corrade::TestSuite::Tester {
struct FunctionsBatchTest: TestSuite::Tester {
explicit FunctionsBatchTest();
void isInf();
@ -93,7 +93,7 @@ void FunctionsBatchTest::isInf() {
Vector2 c[]{{5.0f, -3.0f}, {-2.0f, 14.0f}, {Constants::inf(), -5.0f}};
CORRADE_COMPARE(Math::isInf(c), BitVector<2>{1});
/* Mutable view */
CORRADE_COMPARE(Math::isInf(Corrade::Containers::StridedArrayView1D<Vector2>{c}), BitVector<2>{1});
CORRADE_COMPARE(Math::isInf(Containers::StridedArrayView1D<Vector2>{c}), BitVector<2>{1});
/* This should work without explicit casts or types */
CORRADE_VERIFY(!Math::isInf(std::vector<Float>{5.0f, -2.0f, -1.0f}));
@ -125,7 +125,7 @@ void FunctionsBatchTest::isNan() {
Vector2 c[]{{5.0f, -3.0f}, {14.0f, Constants::nan()}, {-2.0f, -5.0f}};
CORRADE_COMPARE(Math::isNan(c), BitVector<2>{2});
/* Mutable view */
CORRADE_COMPARE(Math::isNan(Corrade::Containers::StridedArrayView1D<Vector2>{c}), BitVector<2>{2});
CORRADE_COMPARE(Math::isNan(Containers::StridedArrayView1D<Vector2>{c}), BitVector<2>{2});
/* This should work without explicit casts or types */
CORRADE_VERIFY(!Math::isNan(std::vector<Float>{5.0f, -2.0f, -1.0f}));
@ -146,7 +146,7 @@ void FunctionsBatchTest::min() {
CORRADE_COMPARE(Math::min(array), -2);
/* Mutable view */
Int marray[]{5, -2, 9};
CORRADE_COMPARE(Math::min(Corrade::Containers::StridedArrayView1D<Int>{marray}), -2);
CORRADE_COMPARE(Math::min(Containers::StridedArrayView1D<Int>{marray}), -2);
/* This should work without explicit casts or types */
CORRADE_COMPARE(Math::min(std::vector<Int>{5, -2, 9}), -2);
@ -167,7 +167,7 @@ void FunctionsBatchTest::max() {
CORRADE_COMPARE(Math::max(array), 9);
/* Mutable view */
Int marray[]{5, -2, 9};
CORRADE_COMPARE(Math::max(Corrade::Containers::StridedArrayView1D<Int>{marray}), 9);
CORRADE_COMPARE(Math::max(Containers::StridedArrayView1D<Int>{marray}), 9);
/* This should work without explicit casts or types */
CORRADE_COMPARE(Math::max(std::vector<Int>{5, -2, 9}), 9);
@ -197,7 +197,7 @@ void FunctionsBatchTest::minmax() {
CORRADE_COMPARE(Math::minmax(array), expected);
/* Mutable view */
Float marray[]{-1.0f, 2.0f, -3.0f};
CORRADE_COMPARE(Math::minmax(Corrade::Containers::StridedArrayView1D<Float>{marray}), expected);
CORRADE_COMPARE(Math::minmax(Containers::StridedArrayView1D<Float>{marray}), expected);
/* This should work without explicit casts or types */
CORRADE_COMPARE(Math::minmax(std::vector<Float>{-1.0f, 2.0f, -3.0f}), expected);
@ -295,11 +295,11 @@ void FunctionsBatchTest::constIterable() {
/* It shouldn't try to operate with a const type (such as trying to to
assign to `std::pair<std::size_t, const Vector2>`) internally, instead
it should remove the const */
CORRADE_COMPARE(Math::min(Corrade::Containers::arrayView(data)),
CORRADE_COMPARE(Math::min(Containers::arrayView(data)),
(Vector2{-2, -5}));
CORRADE_COMPARE(Math::max(Corrade::Containers::stridedArrayView(data)),
CORRADE_COMPARE(Math::max(Containers::stridedArrayView(data)),
(Vector2{9, 14}));
CORRADE_COMPARE(Math::minmax(Corrade::Containers::Array<const Vector2>{data, 3, [](const Vector2*, std::size_t){}}),
CORRADE_COMPARE(Math::minmax(Containers::Array<const Vector2>{data, 3, [](const Vector2*, std::size_t){}}),
std::make_pair(Vector2{-2, -5}, Vector2{9, 14}));
}

18
src/Magnum/Math/Test/FunctionsBenchmark.cpp

@ -34,7 +34,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct FunctionsBenchmark: Corrade::TestSuite::Tester {
struct FunctionsBenchmark: TestSuite::Tester {
explicit FunctionsBenchmark();
void sqrt();
@ -125,7 +125,7 @@ template<class T> void FunctionsBenchmark::sqrtInvertedFast() {
setTestCaseTemplateName(TypeTraits<T>::name());
CORRADE_COMPARE_WITH(Test::sqrtInvertedFast(T(25.0)), 1/T(5.0),
Corrade::TestSuite::Compare::around(T(0.0005)));
TestSuite::Compare::around(T(0.0005)));
T a = T(1000000.0);
@ -134,7 +134,7 @@ template<class T> void FunctionsBenchmark::sqrtInvertedFast() {
}
CORRADE_COMPARE_WITH(a, T(1.0),
Corrade::TestSuite::Compare::around(T(0.002)));
TestSuite::Compare::around(T(0.002)));
}
#ifdef CORRADE_TARGET_SSE2
@ -161,7 +161,7 @@ inline Float sqrtSseFromInverted(Float a) {
void FunctionsBenchmark::sqrtSseFromInverted() {
CORRADE_COMPARE_WITH(Test::sqrtSseFromInverted(25.0f), 5.0f,
Corrade::TestSuite::Compare::around(0.0005f));
TestSuite::Compare::around(0.0005f));
Float a = 1000000.0f;
@ -170,7 +170,7 @@ void FunctionsBenchmark::sqrtSseFromInverted() {
}
CORRADE_COMPARE_WITH(a, 1.0f,
Corrade::TestSuite::Compare::around(0.0002f));
TestSuite::Compare::around(0.0002f));
}
inline Float sqrtInvertedSse(Float a) {
@ -179,7 +179,7 @@ inline Float sqrtInvertedSse(Float a) {
void FunctionsBenchmark::sqrtInvertedSse() {
CORRADE_COMPARE_WITH(Test::sqrtInvertedSse(25.0f), 1/5.0f,
Corrade::TestSuite::Compare::around(0.00002f));
TestSuite::Compare::around(0.00002f));
Float a = 1000000.1f;
@ -188,7 +188,7 @@ void FunctionsBenchmark::sqrtInvertedSse() {
}
CORRADE_COMPARE_WITH(a, 1.0f,
Corrade::TestSuite::Compare::around(0.0003f));
TestSuite::Compare::around(0.0003f));
}
#endif
@ -200,7 +200,7 @@ void FunctionsBenchmark::sinCosSeparate() {
a += 0.1f;
}
CORRADE_COMPARE_AS(a, 10.0f, Corrade::TestSuite::Compare::Greater);
CORRADE_COMPARE_AS(a, 10.0f, TestSuite::Compare::Greater);
/* To avoid the whole loop being optimized away */
CORRADE_VERIFY(sin == sin);
@ -216,7 +216,7 @@ void FunctionsBenchmark::sinCosCombined() {
a += 0.1f;
}
CORRADE_COMPARE_AS(a, 10.0f, Corrade::TestSuite::Compare::Greater);
CORRADE_COMPARE_AS(a, 10.0f, TestSuite::Compare::Greater);
/* To avoid the whole loop being optimized away */
CORRADE_VERIFY(sin == sin);

2
src/Magnum/Math/Test/FunctionsTest.cpp

@ -33,7 +33,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct FunctionsTest: Corrade::TestSuite::Tester {
struct FunctionsTest: TestSuite::Tester {
explicit FunctionsTest();
template<class T> void popcount();

38
src/Magnum/Math/Test/HalfTest.cpp

@ -40,7 +40,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct HalfTest: Corrade::TestSuite::Tester {
struct HalfTest: TestSuite::Tester {
explicit HalfTest();
void unpack();
@ -98,16 +98,16 @@ const struct {
constexpr struct {
const char* name;
const char* data;
Corrade::Utility::TweakableState state;
Utility::TweakableState state;
const char* error;
} TweakableErrorData[] {
{"empty", "", Corrade::Utility::TweakableState::Recompile,
{"empty", "", Utility::TweakableState::Recompile,
"Utility::TweakableParser: is not a half literal\n"},
{"integral", "42_h", Corrade::Utility::TweakableState::Recompile,
{"integral", "42_h", Utility::TweakableState::Recompile,
"Utility::TweakableParser: 42_h is not a half literal\n"},
{"garbage after", "42.b_h", Corrade::Utility::TweakableState::Recompile,
{"garbage after", "42.b_h", Utility::TweakableState::Recompile,
"Utility::TweakableParser: unexpected characters b_h after a half literal\n"},
{"different suffix", "42.0u", Corrade::Utility::TweakableState::Recompile, /* not for double */
{"different suffix", "42.0u", Utility::TweakableState::Recompile, /* not for double */
"Utility::TweakableParser: 42.0u has an unexpected suffix, expected _h\n"}
};
#endif
@ -146,10 +146,10 @@ HalfTest::HalfTest() {
#if defined(DOXYGEN_GENERATING_OUTPUT) || defined(CORRADE_TARGET_UNIX) || (defined(CORRADE_TARGET_WINDOWS) && !defined(CORRADE_TARGET_WINDOWS_RT)) || defined(CORRADE_TARGET_EMSCRIPTEN)
addInstancedTests({&HalfTest::tweakable},
Corrade::Containers::arraySize(TweakableData));
Containers::arraySize(TweakableData));
addInstancedTests({&HalfTest::tweakableError},
Corrade::Containers::arraySize(TweakableErrorData));
Containers::arraySize(TweakableErrorData));
#endif
}
@ -275,16 +275,16 @@ Float unpackNaive(UnsignedShort value) {
UnsignedShort packTable(const Float value) {
UnsignedShort out;
packHalfInto(
Corrade::Containers::StridedArrayView2D<const Float>{{&value, 1}, {1, 1}},
Corrade::Containers::StridedArrayView2D<UnsignedShort>{{&out, 1}, {1, 1}});
Containers::StridedArrayView2D<const Float>{{&value, 1}, {1, 1}},
Containers::StridedArrayView2D<UnsignedShort>{{&out, 1}, {1, 1}});
return out;
}
Float unpackTable(const UnsignedShort value) {
Float out;
unpackHalfInto(
Corrade::Containers::StridedArrayView2D<const UnsignedShort>{{&value, 1}, {1, 1}},
Corrade::Containers::StridedArrayView2D<Float>{{&out, 1}, {1, 1}});
Containers::StridedArrayView2D<const UnsignedShort>{{&value, 1}, {1, 1}},
Containers::StridedArrayView2D<Float>{{&out, 1}, {1, 1}});
return out;
}
@ -455,8 +455,8 @@ void HalfTest::pack1kTable() {
src[i] = i*65;
CORRADE_BENCHMARK(100) {
packHalfInto(Corrade::Containers::StridedArrayView2D<Float>{src, {1, 1000}},
Corrade::Containers::StridedArrayView2D<UnsignedShort>{dst, {1, 1000}});
packHalfInto(Containers::StridedArrayView2D<Float>{src, {1, 1000}},
Containers::StridedArrayView2D<UnsignedShort>{dst, {1, 1000}});
}
}
@ -487,8 +487,8 @@ void HalfTest::unpack1kTable() {
src[i] = i*65;
CORRADE_BENCHMARK(100) {
unpackHalfInto(Corrade::Containers::StridedArrayView2D<UnsignedShort>{src, {1, 1000}},
Corrade::Containers::StridedArrayView2D<Float>{dst, {1, 1000}});
unpackHalfInto(Containers::StridedArrayView2D<UnsignedShort>{src, {1, 1000}},
Containers::StridedArrayView2D<Float>{dst, {1, 1000}});
}
}
@ -638,8 +638,8 @@ void HalfTest::debug() {
void HalfTest::tweakable() {
auto&& data = TweakableData[testCaseInstanceId()];
setTestCaseDescription(data.name);
auto result = Corrade::Utility::TweakableParser<Half>::parse(data.data);
CORRADE_COMPARE(result.first(), Corrade::Utility::TweakableState::Success);
auto result = Utility::TweakableParser<Half>::parse(data.data);
CORRADE_COMPARE(result.first(), Utility::TweakableState::Success);
CORRADE_COMPARE(result.second(), data.result);
}
@ -650,7 +650,7 @@ void HalfTest::tweakableError() {
std::ostringstream out;
Warning redirectWarning{&out};
Error redirectError{&out};
Corrade::Utility::TweakableState state = Corrade::Utility::TweakableParser<Half>::parse(data.data).first();
Utility::TweakableState state = Utility::TweakableParser<Half>::parse(data.data).first();
CORRADE_COMPARE(out.str(), data.error);
CORRADE_COMPARE(state, data.state);
}

2
src/Magnum/Math/Test/InterpolationBenchmark.cpp

@ -33,7 +33,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct InterpolationBenchmark: Corrade::TestSuite::Tester {
struct InterpolationBenchmark: TestSuite::Tester {
explicit InterpolationBenchmark();
void baseline();

2
src/Magnum/Math/Test/IntersectionBenchmark.cpp

@ -96,7 +96,7 @@ typedef Math::Range3D<Float> Range3D;
typedef Math::Deg<Float> Deg;
typedef Math::Rad<Float> Rad;
struct IntersectionBenchmark: Corrade::TestSuite::Tester {
struct IntersectionBenchmark: TestSuite::Tester {
explicit IntersectionBenchmark();
void rangeFrustumNaive();

2
src/Magnum/Math/Test/IntersectionTest.cpp

@ -35,7 +35,7 @@ namespace Magnum { namespace Math { namespace Test { namespace {
using namespace Literals;
struct IntersectionTest: Corrade::TestSuite::Tester {
struct IntersectionTest: TestSuite::Tester {
explicit IntersectionTest();
void pointCircle();

2
src/Magnum/Math/Test/Matrix3Test.cpp

@ -57,7 +57,7 @@ template<> struct RectangularMatrixConverter<3, 3, float, Mat3> {
namespace Test { namespace {
struct Matrix3Test: Corrade::TestSuite::Tester {
struct Matrix3Test: TestSuite::Tester {
explicit Matrix3Test();
void construct();

4
src/Magnum/Math/Test/Matrix4Test.cpp

@ -60,7 +60,7 @@ template<> struct RectangularMatrixConverter<4, 4, float, Mat4> {
namespace Test { namespace {
struct Matrix4Test: Corrade::TestSuite::Tester {
struct Matrix4Test: TestSuite::Tester {
explicit Matrix4Test();
void construct();
@ -648,7 +648,7 @@ void Matrix4Test::lookAt() {
CORRADE_COMPARE(dot(-a.backward(), (target - translation).normalized()), 1.0f);
/* Up vector should be in the same direction as X axis */
CORRADE_COMPARE_AS(dot(Vector3::xAxis(), a.up()), 0.0f, Corrade::TestSuite::Compare::Greater);
CORRADE_COMPARE_AS(dot(Vector3::xAxis(), a.up()), 0.0f, TestSuite::Compare::Greater);
/* Just to be sure */
CORRADE_COMPARE(a, Matrix4({ 0.0f, 0.253247f, -0.967402f, 0.0f},

2
src/Magnum/Math/Test/MatrixBenchmark.cpp

@ -31,7 +31,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct MatrixBenchmark: Corrade::TestSuite::Tester {
struct MatrixBenchmark: TestSuite::Tester {
explicit MatrixBenchmark();
void multiply3();

2
src/Magnum/Math/Test/MatrixTest.cpp

@ -57,7 +57,7 @@ template<> struct RectangularMatrixConverter<3, 3, float, Mat3> {
namespace Test { namespace {
struct MatrixTest: Corrade::TestSuite::Tester {
struct MatrixTest: TestSuite::Tester {
explicit MatrixTest();
void construct();

314
src/Magnum/Math/Test/PackingBatchTest.cpp

@ -36,7 +36,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct PackingBatchTest: Corrade::TestSuite::Tester {
struct PackingBatchTest: TestSuite::Tester {
explicit PackingBatchTest();
void unpackUnsignedByte();
@ -184,15 +184,15 @@ void PackingBatchTest::unpackUnsignedByte() {
{0.0f, 1.0f}
};
Corrade::Containers::StridedArrayView1D<Vector2ub> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst, 3, sizeof(Data)};
unpackInto(Corrade::Containers::arrayCast<2, UnsignedByte>(src),
Corrade::Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2ub> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst, 3, sizeof(Data)};
unpackInto(Containers::arrayCast<2, UnsignedByte>(src),
Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::unpack<Vector2>(data[i].src), data[i].dst);
}
@ -213,15 +213,15 @@ void PackingBatchTest::unpackUnsignedShort() {
{0.0f, 1.0f}
};
Corrade::Containers::StridedArrayView1D<Vector2us> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst, 3, sizeof(Data)};
unpackInto(Corrade::Containers::arrayCast<2, UnsignedShort>(src),
Corrade::Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2us> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst, 3, sizeof(Data)};
unpackInto(Containers::arrayCast<2, UnsignedShort>(src),
Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::unpack<Vector2>(data[i].src), data[i].dst);
}
@ -242,15 +242,15 @@ void PackingBatchTest::unpackSignedByte() {
{-1.0f, -1.0f}
};
Corrade::Containers::StridedArrayView1D<Vector2b> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst, 3, sizeof(Data)};
unpackInto(Corrade::Containers::arrayCast<2, Byte>(src),
Corrade::Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2b> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst, 3, sizeof(Data)};
unpackInto(Containers::arrayCast<2, Byte>(src),
Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::unpack<Vector2>(data[i].src), data[i].dst);
}
@ -271,15 +271,15 @@ void PackingBatchTest::unpackSignedShort() {
{-1.0f, -1.0f}
};
Corrade::Containers::StridedArrayView1D<Vector2s> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst, 3, sizeof(Data)};
unpackInto(Corrade::Containers::arrayCast<2, Short>(src),
Corrade::Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2s> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst, 3, sizeof(Data)};
unpackInto(Containers::arrayCast<2, Short>(src),
Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::unpack<Vector2>(data[i].src), data[i].dst);
}
@ -300,15 +300,15 @@ void PackingBatchTest::packUnsignedByte() {
{255, 255}
};
Corrade::Containers::StridedArrayView1D<Vector2> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2ub> dst{data, &data[0].dst, 3, sizeof(Data)};
packInto(Corrade::Containers::arrayCast<2, Float>(src),
Corrade::Containers::arrayCast<2, UnsignedByte>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Vector2ub> dst{data, &data[0].dst, 3, sizeof(Data)};
packInto(Containers::arrayCast<2, Float>(src),
Containers::arrayCast<2, UnsignedByte>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::pack<Vector2ub>(data[i].src), data[i].dst);
}
@ -329,15 +329,15 @@ void PackingBatchTest::packUnsignedShort() {
{65535, 65535}
};
Corrade::Containers::StridedArrayView1D<Vector2> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2us> dst{data, &data[0].dst, 3, sizeof(Data)};
packInto(Corrade::Containers::arrayCast<2, Float>(src),
Corrade::Containers::arrayCast<2, UnsignedShort>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Vector2us> dst{data, &data[0].dst, 3, sizeof(Data)};
packInto(Containers::arrayCast<2, Float>(src),
Containers::arrayCast<2, UnsignedShort>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::pack<Vector2us>(data[i].src), data[i].dst);
}
@ -358,15 +358,15 @@ void PackingBatchTest::packSignedByte() {
{127, 127}
};
Corrade::Containers::StridedArrayView1D<Vector2> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2b> dst{data, &data[0].dst, 3, sizeof(Data)};
packInto(Corrade::Containers::arrayCast<2, Float>(src),
Corrade::Containers::arrayCast<2, Byte>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Vector2b> dst{data, &data[0].dst, 3, sizeof(Data)};
packInto(Containers::arrayCast<2, Float>(src),
Containers::arrayCast<2, Byte>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::pack<Vector2b>(data[i].src), data[i].dst);
}
@ -387,15 +387,15 @@ void PackingBatchTest::packSignedShort() {
{32767, 32767}
};
Corrade::Containers::StridedArrayView1D<Vector2> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2s> dst{data, &data[0].dst, 3, sizeof(Data)};
packInto(Corrade::Containers::arrayCast<2, Float>(src),
Corrade::Containers::arrayCast<2, Short>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Vector2s> dst{data, &data[0].dst, 3, sizeof(Data)};
packInto(Containers::arrayCast<2, Float>(src),
Containers::arrayCast<2, Short>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::pack<Vector2s>(data[i].src), data[i].dst);
}
@ -418,17 +418,17 @@ void PackingBatchTest::unpackHalf() {
{-Constants::inf(), +Constants::inf()}
};
Corrade::Containers::StridedArrayView1D<Vector2us> src{data, &data[0].src,
Corrade::Containers::arraySize(data), sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst,
Corrade::Containers::arraySize(data), sizeof(Data)};
unpackHalfInto(Corrade::Containers::arrayCast<2, UnsignedShort>(src),
Corrade::Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2us> src{data, &data[0].src,
Containers::arraySize(data), sizeof(Data)};
Containers::StridedArrayView1D<Vector2> dst{data, &data[0].dst,
Containers::arraySize(data), sizeof(Data)};
unpackHalfInto(Containers::arrayCast<2, UnsignedShort>(src),
Containers::arrayCast<2, Float>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::unpackHalf(data[i].src), data[i].dst);
}
@ -451,17 +451,17 @@ void PackingBatchTest::packHalf() {
{0xfc00, 0x7c00}
};
Corrade::Containers::StridedArrayView1D<Vector2> src{data, &data[0].src,
Corrade::Containers::arraySize(data), sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Vector2us> dst{data, &data[0].dst,
Corrade::Containers::arraySize(data), sizeof(Data)};
packHalfInto(Corrade::Containers::arrayCast<2, Float>(src),
Corrade::Containers::arrayCast<2, UnsignedShort>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expected),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Vector2> src{data, &data[0].src,
Containers::arraySize(data), sizeof(Data)};
Containers::StridedArrayView1D<Vector2us> dst{data, &data[0].dst,
Containers::arraySize(data), sizeof(Data)};
packHalfInto(Containers::arrayCast<2, Float>(src),
Containers::arrayCast<2, UnsignedShort>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expected),
TestSuite::Compare::Container);
/* Ensure the results are consistent with non-batch APIs */
for(std::size_t i = 0; i != Corrade::Containers::arraySize(data); ++i)
for(std::size_t i = 0; i != Containers::arraySize(data); ++i)
CORRADE_COMPARE(Math::packHalf(data[i].src), data[i].dst);
}
@ -491,18 +491,18 @@ template<class FloatingPoint, class Integral> void PackingBatchTest::castUnsigne
{13, 255}
};
Corrade::Containers::StridedArrayView1D<Math::Vector2<Integral>> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Math::Vector2<FloatingPoint>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Corrade::Containers::arrayCast<2, Integral>(src),
Corrade::Containers::arrayCast<2, FloatingPoint>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expectedFloatingPoint),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Math::Vector2<Integral>> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Math::Vector2<FloatingPoint>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Containers::arrayCast<2, Integral>(src),
Containers::arrayCast<2, FloatingPoint>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expectedFloatingPoint),
TestSuite::Compare::Container);
/* Test the other way around as well */
castInto(Corrade::Containers::arrayCast<2, FloatingPoint>(dst),
Corrade::Containers::arrayCast<2, Integral>(src));
CORRADE_COMPARE_AS(src, Corrade::Containers::stridedArrayView(expectedIntegral),
Corrade::TestSuite::Compare::Container);
castInto(Containers::arrayCast<2, FloatingPoint>(dst),
Containers::arrayCast<2, Integral>(src));
CORRADE_COMPARE_AS(src, Containers::stridedArrayView(expectedIntegral),
TestSuite::Compare::Container);
}
template<class FloatingPoint, class Integral> void PackingBatchTest::castSignedFloatingPoint() {
@ -531,18 +531,18 @@ template<class FloatingPoint, class Integral> void PackingBatchTest::castSignedF
{13, 127}
};
Corrade::Containers::StridedArrayView1D<Math::Vector2<Integral>> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Math::Vector2<FloatingPoint>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Corrade::Containers::arrayCast<2, Integral>(src),
Corrade::Containers::arrayCast<2, FloatingPoint>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expectedFloatingPoint),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Math::Vector2<Integral>> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Math::Vector2<FloatingPoint>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Containers::arrayCast<2, Integral>(src),
Containers::arrayCast<2, FloatingPoint>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expectedFloatingPoint),
TestSuite::Compare::Container);
/* Test the other way around as well */
castInto(Corrade::Containers::arrayCast<2, FloatingPoint>(dst),
Corrade::Containers::arrayCast<2, Integral>(src));
CORRADE_COMPARE_AS(src, Corrade::Containers::stridedArrayView(expectedIntegral),
Corrade::TestSuite::Compare::Container);
castInto(Containers::arrayCast<2, FloatingPoint>(dst),
Containers::arrayCast<2, Integral>(src));
CORRADE_COMPARE_AS(src, Containers::stridedArrayView(expectedIntegral),
TestSuite::Compare::Container);
}
template<class T, class U> void PackingBatchTest::castUnsignedInteger() {
@ -569,18 +569,18 @@ template<class T, class U> void PackingBatchTest::castUnsignedInteger() {
{13, 255}
};
Corrade::Containers::StridedArrayView1D<Math::Vector2<T>> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Math::Vector2<U>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Corrade::Containers::arrayCast<2, T>(src),
Corrade::Containers::arrayCast<2, U>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expectedTargetType),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Math::Vector2<T>> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Math::Vector2<U>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Containers::arrayCast<2, T>(src),
Containers::arrayCast<2, U>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expectedTargetType),
TestSuite::Compare::Container);
/* Test the other way around as well */
castInto(Corrade::Containers::arrayCast<2, U>(dst),
Corrade::Containers::arrayCast<2, T>(src));
CORRADE_COMPARE_AS(src, Corrade::Containers::stridedArrayView(expectedOriginalType),
Corrade::TestSuite::Compare::Container);
castInto(Containers::arrayCast<2, U>(dst),
Containers::arrayCast<2, T>(src));
CORRADE_COMPARE_AS(src, Containers::stridedArrayView(expectedOriginalType),
TestSuite::Compare::Container);
}
template<class T, class U> void PackingBatchTest::castSignedInteger() {
@ -607,18 +607,18 @@ template<class T, class U> void PackingBatchTest::castSignedInteger() {
{13, 127}
};
Corrade::Containers::StridedArrayView1D<Math::Vector2<T>> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Math::Vector2<U>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Corrade::Containers::arrayCast<2, T>(src),
Corrade::Containers::arrayCast<2, U>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expectedTargetType),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Math::Vector2<T>> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Math::Vector2<U>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Containers::arrayCast<2, T>(src),
Containers::arrayCast<2, U>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expectedTargetType),
TestSuite::Compare::Container);
/* Test the other way around as well */
castInto(Corrade::Containers::arrayCast<2, U>(dst),
Corrade::Containers::arrayCast<2, T>(src));
CORRADE_COMPARE_AS(src, Corrade::Containers::stridedArrayView(expectedOriginalType),
Corrade::TestSuite::Compare::Container);
castInto(Containers::arrayCast<2, U>(dst),
Containers::arrayCast<2, T>(src));
CORRADE_COMPARE_AS(src, Containers::stridedArrayView(expectedOriginalType),
TestSuite::Compare::Container);
}
template<class T, class U> void PackingBatchTest::castFloatDouble() {
@ -643,18 +643,18 @@ template<class T, class U> void PackingBatchTest::castFloatDouble() {
{T(13.0), T(127.5)}
};
Corrade::Containers::StridedArrayView1D<Math::Vector2<T>> src{data, &data[0].src, 3, sizeof(Data)};
Corrade::Containers::StridedArrayView1D<Math::Vector2<U>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Corrade::Containers::arrayCast<2, T>(src),
Corrade::Containers::arrayCast<2, U>(dst));
CORRADE_COMPARE_AS(dst, Corrade::Containers::stridedArrayView(expectedTargetType),
Corrade::TestSuite::Compare::Container);
Containers::StridedArrayView1D<Math::Vector2<T>> src{data, &data[0].src, 3, sizeof(Data)};
Containers::StridedArrayView1D<Math::Vector2<U>> dst{data, &data[0].dst, 3, sizeof(Data)};
castInto(Containers::arrayCast<2, T>(src),
Containers::arrayCast<2, U>(dst));
CORRADE_COMPARE_AS(dst, Containers::stridedArrayView(expectedTargetType),
TestSuite::Compare::Container);
/* Test the other way around as well */
castInto(Corrade::Containers::arrayCast<2, U>(dst),
Corrade::Containers::arrayCast<2, T>(src));
CORRADE_COMPARE_AS(src, Corrade::Containers::stridedArrayView(expectedOriginalType),
Corrade::TestSuite::Compare::Container);
castInto(Containers::arrayCast<2, U>(dst),
Containers::arrayCast<2, T>(src));
CORRADE_COMPARE_AS(src, Containers::stridedArrayView(expectedOriginalType),
TestSuite::Compare::Container);
}
template<class T> void PackingBatchTest::assertionsPackUnpack() {
@ -667,18 +667,18 @@ template<class T> void PackingBatchTest::assertionsPackUnpack() {
Vector3 resultWrongVectorSize[2]{};
Vector4 resultNonContiguous[2]{};
auto src = Corrade::Containers::arrayCast<2, T>(
Corrade::Containers::arrayView(data));
auto srcNonContiguous = Corrade::Containers::arrayCast<2, T>(
Corrade::Containers::arrayView(dataNonContiguous)).every({1, 2});
auto dst = Corrade::Containers::arrayCast<2, Float>(
Corrade::Containers::arrayView(result));
auto dstWrongCount = Corrade::Containers::arrayCast<2, Float>(
Corrade::Containers::arrayView(resultWrongCount));
auto dstWrongVectorSize = Corrade::Containers::arrayCast<2, Float>(
Corrade::Containers::arrayView(resultWrongVectorSize));
auto dstNotContiguous = Corrade::Containers::arrayCast<2, Float>(
Corrade::Containers::arrayView(resultNonContiguous)).every({1, 2});
auto src = Containers::arrayCast<2, T>(
Containers::arrayView(data));
auto srcNonContiguous = Containers::arrayCast<2, T>(
Containers::arrayView(dataNonContiguous)).every({1, 2});
auto dst = Containers::arrayCast<2, Float>(
Containers::arrayView(result));
auto dstWrongCount = Containers::arrayCast<2, Float>(
Containers::arrayView(resultWrongCount));
auto dstWrongVectorSize = Containers::arrayCast<2, Float>(
Containers::arrayView(resultWrongVectorSize));
auto dstNotContiguous = Containers::arrayCast<2, Float>(
Containers::arrayView(resultNonContiguous)).every({1, 2});
std::ostringstream out;
Error redirectError{&out};
@ -711,18 +711,18 @@ void PackingBatchTest::assertionsPackUnpackHalf() {
Vector3 resultWrongVectorSize[2]{};
Vector4 resultNonContiguous[2]{};
auto src = Corrade::Containers::arrayCast<2, UnsignedShort>(
Corrade::Containers::arrayView(data));
auto srcNonContiguous = Corrade::Containers::arrayCast<2, UnsignedShort>(
Corrade::Containers::arrayView(dataNonContiguous)).every({1, 2});
auto dst = Corrade::Containers::arrayCast<2, Float>(
Corrade::Containers::arrayView(result));
auto dstWrongCount = Corrade::Containers::arrayCast<2, Float>(
Corrade::Containers::arrayView(resultWrongCount));
auto dstWrongVectorSize = Corrade::Containers::arrayCast<2, Float>(
Corrade::Containers::arrayView(resultWrongVectorSize));
auto dstNotContiguous = Corrade::Containers::arrayCast<2, Float>(
Corrade::Containers::arrayView(resultNonContiguous)).every({1, 2});
auto src = Containers::arrayCast<2, UnsignedShort>(
Containers::arrayView(data));
auto srcNonContiguous = Containers::arrayCast<2, UnsignedShort>(
Containers::arrayView(dataNonContiguous)).every({1, 2});
auto dst = Containers::arrayCast<2, Float>(
Containers::arrayView(result));
auto dstWrongCount = Containers::arrayCast<2, Float>(
Containers::arrayView(resultWrongCount));
auto dstWrongVectorSize = Containers::arrayCast<2, Float>(
Containers::arrayView(resultWrongVectorSize));
auto dstNotContiguous = Containers::arrayCast<2, Float>(
Containers::arrayView(resultNonContiguous)).every({1, 2});
std::ostringstream out;
Error redirectError{&out};
@ -755,14 +755,14 @@ template<class U, class T> void PackingBatchTest::assertionsCast() {
Math::Vector3<U> resultWrongVectorSize[2]{};
Math::Vector4<U> resultNonContiguous[2]{};
auto src = Corrade::Containers::arrayCast<2, T>(
Corrade::Containers::arrayView(data));
auto dstWrongCount = Corrade::Containers::arrayCast<2, U>(
Corrade::Containers::arrayView(resultWrongCount));
auto dstWrongVectorSize = Corrade::Containers::arrayCast<2, U>(
Corrade::Containers::arrayView(resultWrongVectorSize));
auto dstNotContiguous = Corrade::Containers::arrayCast<2, U>(
Corrade::Containers::arrayView(resultNonContiguous)).every({1, 2});
auto src = Containers::arrayCast<2, T>(
Containers::arrayView(data));
auto dstWrongCount = Containers::arrayCast<2, U>(
Containers::arrayView(resultWrongCount));
auto dstWrongVectorSize = Containers::arrayCast<2, U>(
Containers::arrayView(resultWrongVectorSize));
auto dstNotContiguous = Containers::arrayCast<2, U>(
Containers::arrayView(resultNonContiguous)).every({1, 2});
std::ostringstream out;
Error redirectError{&out};

2
src/Magnum/Math/Test/PackingTest.cpp

@ -31,7 +31,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct PackingTest: Corrade::TestSuite::Tester {
struct PackingTest: TestSuite::Tester {
explicit PackingTest();
void bitMax();

24
src/Magnum/Math/Test/QuaternionTest.cpp

@ -55,7 +55,7 @@ template<> struct QuaternionConverter<Float, Quat> {
namespace Test { namespace {
struct QuaternionTest: Corrade::TestSuite::Tester {
struct QuaternionTest: TestSuite::Tester {
explicit QuaternionTest();
void construct();
@ -350,8 +350,8 @@ void QuaternionTest::data() {
CORRADE_COMPARE(ca.data()[1], 2.0f);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 4);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 4);
CORRADE_COMPARE(Containers::arraySize(a.data()), 4);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 4);
}
void QuaternionTest::compare() {
@ -554,9 +554,9 @@ void QuaternionTest::angle() {
/* Same / opposite. Well, almost. It's interesting how imprecise
normalization can get. */
CORRADE_COMPARE_WITH(Math::halfAngle(a, a), 0.0_radf,
Corrade::TestSuite::Compare::around(0.0005_radf));
TestSuite::Compare::around(0.0005_radf));
CORRADE_COMPARE_WITH(Math::halfAngle(a, -a), 180.0_degf,
Corrade::TestSuite::Compare::around(0.0005_radf));
TestSuite::Compare::around(0.0005_radf));
/* Trivial case, to verify it's actually returning the right value (hah) */
CORRADE_COMPARE(Math::halfAngle(
@ -601,36 +601,36 @@ void QuaternionTest::matrix() {
CORRADE_COMPARE((-q).toMatrix(), m);
/* Trace > 0 */
CORRADE_COMPARE_AS(m.trace(), 0.0f, Corrade::TestSuite::Compare::Greater);
CORRADE_COMPARE_AS(m.trace(), 0.0f, TestSuite::Compare::Greater);
CORRADE_COMPARE(Quaternion::fromMatrix(m), q);
/* Trace < 0, max is diagonal[2] */
Matrix3x3 m2 = Matrix4::rotation(130.0_degf, axis).rotationScaling();
Quaternion q2 = Quaternion::rotation(130.0_degf, axis);
CORRADE_COMPARE_AS(m2.trace(), 0.0f, Corrade::TestSuite::Compare::Less);
CORRADE_COMPARE_AS(m2.trace(), 0.0f, TestSuite::Compare::Less);
CORRADE_COMPARE_AS(m2.diagonal()[2],
Math::max(m2.diagonal()[0], m2.diagonal()[1]),
Corrade::TestSuite::Compare::Greater);
TestSuite::Compare::Greater);
CORRADE_COMPARE(Quaternion::fromMatrix(m2), q2);
/* Trace < 0, max is diagonal[1] */
Vector3 axis2 = Vector3(-3.0f, 5.0f, 1.0f).normalized();
Matrix3x3 m3 = Matrix4::rotation(130.0_degf, axis2).rotationScaling();
Quaternion q3 = Quaternion::rotation(130.0_degf, axis2);
CORRADE_COMPARE_AS(m3.trace(), 0.0f, Corrade::TestSuite::Compare::Less);
CORRADE_COMPARE_AS(m3.trace(), 0.0f, TestSuite::Compare::Less);
CORRADE_COMPARE_AS(m3.diagonal()[1],
Math::max(m3.diagonal()[0], m3.diagonal()[2]),
Corrade::TestSuite::Compare::Greater);
TestSuite::Compare::Greater);
CORRADE_COMPARE(Quaternion::fromMatrix(m3), q3);
/* Trace < 0, max is diagonal[0] */
Vector3 axis3 = Vector3(5.0f, -3.0f, 1.0f).normalized();
Matrix3x3 m4 = Matrix4::rotation(130.0_degf, axis3).rotationScaling();
Quaternion q4 = Quaternion::rotation(130.0_degf, axis3);
CORRADE_COMPARE_AS(m4.trace(), 0.0f, Corrade::TestSuite::Compare::Less);
CORRADE_COMPARE_AS(m4.trace(), 0.0f, TestSuite::Compare::Less);
CORRADE_COMPARE_AS(m4.diagonal()[0],
Math::max(m4.diagonal()[1], m4.diagonal()[2]),
Corrade::TestSuite::Compare::Greater);
TestSuite::Compare::Greater);
CORRADE_COMPARE(Quaternion::fromMatrix(m4), q4);
/* One reflection is bad (asserts in the test below), but two are fine */

14
src/Magnum/Math/Test/RangeTest.cpp

@ -96,7 +96,7 @@ template<> struct RangeConverter<3, Float, Box> {
namespace Test { namespace {
struct RangeTest: Corrade::TestSuite::Tester {
struct RangeTest: TestSuite::Tester {
explicit RangeTest();
void construct();
@ -460,12 +460,12 @@ void RangeTest::data() {
CORRADE_COMPARE(ccube.data()[2], -17);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(line.data()), 2);
CORRADE_COMPARE(Corrade::Containers::arraySize(cline.data()), 2);
CORRADE_COMPARE(Corrade::Containers::arraySize(rect.data()), 4);
CORRADE_COMPARE(Corrade::Containers::arraySize(crect.data()), 4);
CORRADE_COMPARE(Corrade::Containers::arraySize(cube.data()), 6);
CORRADE_COMPARE(Corrade::Containers::arraySize(ccube.data()), 6);
CORRADE_COMPARE(Containers::arraySize(line.data()), 2);
CORRADE_COMPARE(Containers::arraySize(cline.data()), 2);
CORRADE_COMPARE(Containers::arraySize(rect.data()), 4);
CORRADE_COMPARE(Containers::arraySize(crect.data()), 4);
CORRADE_COMPARE(Containers::arraySize(cube.data()), 6);
CORRADE_COMPARE(Containers::arraySize(ccube.data()), 6);
}
void RangeTest::access() {

6
src/Magnum/Math/Test/RectangularMatrixTest.cpp

@ -55,7 +55,7 @@ template<> struct RectangularMatrixConverter<2, 3, Float, Mat2x3> {
namespace Test { namespace {
struct RectangularMatrixTest: Corrade::TestSuite::Tester {
struct RectangularMatrixTest: TestSuite::Tester {
explicit RectangularMatrixTest();
void construct();
@ -438,8 +438,8 @@ void RectangularMatrixTest::data() {
CORRADE_COMPARE(ca.data()[1], 5.0f);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 12);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 12);
CORRADE_COMPARE(Containers::arraySize(a.data()), 12);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 12);
}
void RectangularMatrixTest::row() {

2
src/Magnum/Math/Test/StrictWeakOrderingTest.cpp

@ -37,7 +37,7 @@ namespace std {
namespace Magnum { namespace Math { namespace Test { namespace {
struct StrictWeakOrderingTest: Corrade::TestSuite::Tester {
struct StrictWeakOrderingTest: TestSuite::Tester {
explicit StrictWeakOrderingTest();
void base();

2
src/Magnum/Math/Test/SwizzleTest.cpp

@ -29,7 +29,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct SwizzleTest: Corrade::TestSuite::Tester {
struct SwizzleTest: TestSuite::Tester {
explicit SwizzleTest();
void gather();

3
src/Magnum/Math/Test/TagsTest.cpp

@ -25,11 +25,12 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Magnum.h"
#include "Magnum/Math/Tags.h"
namespace Magnum { namespace Math { namespace Test { namespace {
struct TagsTest: Corrade::TestSuite::Tester {
struct TagsTest: TestSuite::Tester {
explicit TagsTest();
void noDefaultConstructor();

44
src/Magnum/Math/Test/TypeTraitsTest.cpp

@ -34,7 +34,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct TypeTraitsTest: Corrade::TestSuite::Tester {
struct TypeTraitsTest: TestSuite::Tester {
explicit TypeTraitsTest();
void name();
@ -155,13 +155,13 @@ TypeTraitsTest::TypeTraitsTest() {
&TypeTraitsTest::equalsZeroFloatingPoint<Float>,
&TypeTraitsTest::equalsZeroFloatingPoint<Double>,
&TypeTraitsTest::equalsZeroFloatingPoint<long double>},
Corrade::Containers::arraySize(EqualsZeroData));
Containers::arraySize(EqualsZeroData));
addTests({&TypeTraitsTest::equal});
}
void TypeTraitsTest::name() {
using namespace Corrade::Containers::Literals;
using namespace Containers::Literals;
CORRADE_COMPARE(TypeTraits<UnsignedShort>::name(), "UnsignedShort"_s);
CORRADE_COMPARE(TypeTraits<Float>::name(), "Float"_s);
}
@ -244,7 +244,7 @@ template<class T> void TypeTraitsTest::epsilonConsistentWithCorrade() {
/* Using VERIFY because we *don't* want fuzzy comparison in this case. The
equals*() tests below do further checks against TestSuite. */
CORRADE_VERIFY(TypeTraits<T>::epsilon() == Corrade::Utility::Implementation::FloatPrecision<T>::epsilon());
CORRADE_VERIFY(TypeTraits<T>::epsilon() == Utility::Implementation::FloatPrecision<T>::epsilon());
}
template<class T> void TypeTraitsTest::equalsIntegral() {
@ -271,12 +271,12 @@ template<class T> void TypeTraitsTest::equalsFloatingPoint0() {
/* Ensure we have the same behavior as TestSuite. Done in addition to the
epsilonConsistentWithCorrade() test above, since that one alone might
give a false sense of security. */
CORRADE_COMPARE(Corrade::TestSuite::Implementation::FloatComparator<T>{}(
CORRADE_COMPARE(TestSuite::Implementation::FloatComparator<T>{}(
T(0)+TypeTraits<T>::epsilon()/T(2), T(0)),
Corrade::TestSuite::ComparisonStatusFlags{});
CORRADE_COMPARE(Corrade::TestSuite::Implementation::FloatComparator<T>{}(
TestSuite::ComparisonStatusFlags{});
CORRADE_COMPARE(TestSuite::Implementation::FloatComparator<T>{}(
T(0)+TypeTraits<T>::epsilon()*T(2), T(0)),
Corrade::TestSuite::ComparisonStatusFlag::Failed);
TestSuite::ComparisonStatusFlag::Failed);
}
template<class T> void TypeTraitsTest::equalsFloatingPoint1() {
@ -288,12 +288,12 @@ template<class T> void TypeTraitsTest::equalsFloatingPoint1() {
/* Ensure we have the same behavior as TestSuite. Done in addition to the
epsilonConsistentWithCorrade() test above, since that one alone might
give a false sense of security. */
CORRADE_COMPARE(Corrade::TestSuite::Implementation::FloatComparator<T>{}(
CORRADE_COMPARE(TestSuite::Implementation::FloatComparator<T>{}(
T(1)+TypeTraits<T>::epsilon()/T(2), T(1)),
Corrade::TestSuite::ComparisonStatusFlags{});
CORRADE_COMPARE(Corrade::TestSuite::Implementation::FloatComparator<T>{}(
TestSuite::ComparisonStatusFlags{});
CORRADE_COMPARE(TestSuite::Implementation::FloatComparator<T>{}(
T(1)+TypeTraits<T>::epsilon()*T(3), T(1)),
Corrade::TestSuite::ComparisonStatusFlag::Failed);
TestSuite::ComparisonStatusFlag::Failed);
}
template<class T> void TypeTraitsTest::equalsFloatingPointLarge() {
@ -305,12 +305,12 @@ template<class T> void TypeTraitsTest::equalsFloatingPointLarge() {
/* Ensure we have the same behavior as TestSuite. Done in addition to the
epsilonConsistentWithCorrade() test above, since that one alone might
give a false sense of security. */
CORRADE_COMPARE(Corrade::TestSuite::Implementation::FloatComparator<T>{}(
CORRADE_COMPARE(TestSuite::Implementation::FloatComparator<T>{}(
T(25)+TypeTraits<T>::epsilon()*T(2), T(25)),
Corrade::TestSuite::ComparisonStatusFlags{});
CORRADE_COMPARE(Corrade::TestSuite::Implementation::FloatComparator<T>{}(
TestSuite::ComparisonStatusFlags{});
CORRADE_COMPARE(TestSuite::Implementation::FloatComparator<T>{}(
T(25)+TypeTraits<T>::epsilon()*T(75), T(25)),
Corrade::TestSuite::ComparisonStatusFlag::Failed);
TestSuite::ComparisonStatusFlag::Failed);
}
template<class T> void TypeTraitsTest::equalsFloatingPointInfinity() {
@ -324,12 +324,12 @@ template<class T> void TypeTraitsTest::equalsFloatingPointInfinity() {
/* Ensure we have the same behavior as TestSuite. Done in addition to the
epsilonConsistentWithCorrade() test above, since that one alone might
give a false sense of security. */
CORRADE_COMPARE(Corrade::TestSuite::Implementation::FloatComparator<T>{}(
CORRADE_COMPARE(TestSuite::Implementation::FloatComparator<T>{}(
Constants<T>::inf(), Constants<T>::inf()),
Corrade::TestSuite::ComparisonStatusFlags{});
CORRADE_COMPARE(Corrade::TestSuite::Implementation::FloatComparator<T>{}(
TestSuite::ComparisonStatusFlags{});
CORRADE_COMPARE(TestSuite::Implementation::FloatComparator<T>{}(
Constants<T>::inf(), -Constants<T>::inf()),
Corrade::TestSuite::ComparisonStatusFlag::Failed);
TestSuite::ComparisonStatusFlag::Failed);
}
template<class T> void TypeTraitsTest::equalsFloatingPointNaN() {
@ -340,9 +340,9 @@ template<class T> void TypeTraitsTest::equalsFloatingPointNaN() {
/* OTOH, TestSuite compares two NaNs as equal -- since that makes more
sense in the context of tests */
CORRADE_COMPARE(Corrade::TestSuite::Implementation::FloatComparator<T>{}(
CORRADE_COMPARE(TestSuite::Implementation::FloatComparator<T>{}(
Constants<T>::nan(), Constants<T>::nan()),
Corrade::TestSuite::ComparisonStatusFlags{});
TestSuite::ComparisonStatusFlags{});
}
/* Argh! Why there is no standard std::abs() for unsigned types? */

5
src/Magnum/Math/Test/UnitTest.cpp

@ -26,12 +26,13 @@
#include <new>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Magnum.h"
#include "Magnum/Math/Constants.h"
#include "Magnum/Math/Unit.h"
namespace Magnum { namespace Math { namespace Test { namespace {
struct UnitTest: Corrade::TestSuite::Tester {
struct UnitTest: TestSuite::Tester {
explicit UnitTest();
void construct();
@ -68,7 +69,7 @@ typedef Unit<Sec_, Float> Sec;
typedef Unit<Sec_, Int> Seci;
typedef Constants<Float> Constants;
inline Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, Sec value) {
inline Debug& operator<<(Debug& debug, Sec value) {
return debug << Float(value);
}

2
src/Magnum/Math/Test/Vector2Test.cpp

@ -53,7 +53,7 @@ template<> struct VectorConverter<2, float, Vec2> {
namespace Test { namespace {
struct Vector2Test: Corrade::TestSuite::Tester {
struct Vector2Test: TestSuite::Tester {
explicit Vector2Test();
void construct();

2
src/Magnum/Math/Test/Vector3Test.cpp

@ -53,7 +53,7 @@ template<> struct VectorConverter<3, float, Vec3> {
namespace Test { namespace {
struct Vector3Test: Corrade::TestSuite::Tester {
struct Vector3Test: TestSuite::Tester {
explicit Vector3Test();
void construct();

2
src/Magnum/Math/Test/Vector4Test.cpp

@ -53,7 +53,7 @@ template<> struct VectorConverter<4, float, Vec4> {
namespace Test { namespace {
struct Vector4Test: Corrade::TestSuite::Tester {
struct Vector4Test: TestSuite::Tester {
explicit Vector4Test();
void construct();

2
src/Magnum/Math/Test/VectorBenchmark.cpp

@ -33,7 +33,7 @@
namespace Magnum { namespace Math { namespace Test { namespace {
struct VectorBenchmark: Corrade::TestSuite::Tester {
struct VectorBenchmark: TestSuite::Tester {
explicit VectorBenchmark();
void dot();

10
src/Magnum/Math/Test/VectorTest.cpp

@ -54,7 +54,7 @@ template<> struct VectorConverter<3, Float, Vec3> {
namespace Test { namespace {
struct VectorTest: Corrade::TestSuite::Tester {
struct VectorTest: TestSuite::Tester {
explicit VectorTest();
void construct();
@ -366,8 +366,8 @@ void VectorTest::data() {
CORRADE_COMPARE(g, 1.0f);
/* It actually returns an array */
CORRADE_COMPARE(Corrade::Containers::arraySize(a.data()), 4);
CORRADE_COMPARE(Corrade::Containers::arraySize(ca.data()), 4);
CORRADE_COMPARE(Containers::arraySize(a.data()), 4);
CORRADE_COMPARE(Containers::arraySize(ca.data()), 4);
}
void VectorTest::compare() {
@ -605,9 +605,9 @@ void VectorTest::angle() {
/* Same / opposite. Well, almost. It's interesting how imprecise
normalization can get. */
CORRADE_COMPARE_WITH(Math::angle(a, a), 0.0_radf,
Corrade::TestSuite::Compare::around(0.0005_radf));
TestSuite::Compare::around(0.0005_radf));
CORRADE_COMPARE_WITH(Math::angle(a, -a), 180.0_degf,
Corrade::TestSuite::Compare::around(0.0005_radf));
TestSuite::Compare::around(0.0005_radf));
}
void VectorTest::angleNormalizedButOver1() {

6
src/Magnum/Math/TypeTraits.h

@ -351,9 +351,9 @@ template<class T> struct TypeTraits: Implementation::TypeTraitsDefault<T> {
* 80-bit, and @cpp 1.0e-14l @ce on platforms
* @ref CORRADE_LONG_DOUBLE_SAME_AS_DOUBLE "where it is 64-bit".
*
* This matches fuzzy comparison precision in @ref Corrade::TestSuite and
* is always one digit less than how @ref Corrade::Utility::Debug or
* @ref Corrade::Utility::format() prints given type.
* This matches fuzzy comparison precision in
* @relativeref{Corrade,TestSuite} and is always one digit less than how
* @ref Debug or @ref Utility::format() prints given type.
*/
constexpr static T epsilon();

51
src/Magnum/Math/Vector.h

@ -36,6 +36,7 @@
#include <Corrade/Utility/DebugAssert.h>
#include <Corrade/Utility/StlMath.h>
#include "Magnum/Magnum.h"
#include "Magnum/visibility.h"
#include "Magnum/Math/Angle.h"
#include "Magnum/Math/BitVector.h"
@ -177,7 +178,7 @@ template<std::size_t size, class T> class Vector {
* @see @ref Vector4::pad(const Vector<otherSize, T>&, T, T)
*/
template<std::size_t otherSize> constexpr static Vector<size, T> pad(const Vector<otherSize, T>& a, T value = T()) {
return padInternal<otherSize>(typename Corrade::Containers::Implementation::GenerateSequence<size>::Type{}, a, value);
return padInternal<otherSize>(typename Containers::Implementation::GenerateSequence<size>::Type{}, a, value);
}
/**
@ -210,7 +211,7 @@ template<std::size_t size, class T> class Vector {
#ifdef DOXYGEN_GENERATING_OUTPUT
constexpr explicit Vector(T value) noexcept;
#else
template<class U, class V = typename std::enable_if<std::is_same<T, U>::value && size != 1, T>::type> constexpr explicit Vector(U value) noexcept: Vector(typename Corrade::Containers::Implementation::GenerateSequence<size>::Type{}, value) {}
template<class U, class V = typename std::enable_if<std::is_same<T, U>::value && size != 1, T>::type> constexpr explicit Vector(U value) noexcept: Vector(typename Containers::Implementation::GenerateSequence<size>::Type{}, value) {}
#endif
/**
@ -221,7 +222,7 @@ template<std::size_t size, class T> class Vector {
*
* @snippet MagnumMath.cpp Vector-conversion
*/
template<class U> constexpr explicit Vector(const Vector<size, U>& other) noexcept: Vector(typename Corrade::Containers::Implementation::GenerateSequence<size>::Type{}, other) {}
template<class U> constexpr explicit Vector(const Vector<size, U>& other) noexcept: Vector(typename Containers::Implementation::GenerateSequence<size>::Type{}, other) {}
/** @brief Construct a vector from external representation */
template<class U, class V = decltype(Implementation::VectorConverter<size, T, U>::from(std::declval<U>()))> constexpr explicit Vector(const U& other) noexcept: Vector(Implementation::VectorConverter<size, T, U>::from(other)) {}
@ -641,7 +642,7 @@ template<std::size_t size, class T> class Vector {
* @ref RectangularMatrix::flippedRows()
*/
constexpr Vector<size, T> flipped() const {
return flippedInternal(typename Corrade::Containers::Implementation::GenerateSequence<size>::Type{});
return flippedInternal(typename Containers::Implementation::GenerateSequence<size>::Type{});
}
/**
@ -715,16 +716,16 @@ template<std::size_t size, class T> class Vector {
template<std::size_t size_, class U> friend U dot(const Vector<size_, U>&, const Vector<size_, U>&);
/* Implementation for Vector<size, T>::Vector(const Vector<size, U>&) */
template<class U, std::size_t ...sequence> constexpr explicit Vector(Corrade::Containers::Implementation::Sequence<sequence...>, const Vector<size, U>& vector) noexcept: _data{T(vector._data[sequence])...} {}
template<class U, std::size_t ...sequence> constexpr explicit Vector(Containers::Implementation::Sequence<sequence...>, const Vector<size, U>& vector) noexcept: _data{T(vector._data[sequence])...} {}
/* Implementation for Vector<size, T>::Vector(U) */
template<std::size_t ...sequence> constexpr explicit Vector(Corrade::Containers::Implementation::Sequence<sequence...>, T value) noexcept: _data{Implementation::repeat(value, sequence)...} {}
template<std::size_t ...sequence> constexpr explicit Vector(Containers::Implementation::Sequence<sequence...>, T value) noexcept: _data{Implementation::repeat(value, sequence)...} {}
template<std::size_t otherSize, std::size_t ...sequence> constexpr static Vector<size, T> padInternal(Corrade::Containers::Implementation::Sequence<sequence...>, const Vector<otherSize, T>& a, T value) {
template<std::size_t otherSize, std::size_t ...sequence> constexpr static Vector<size, T> padInternal(Containers::Implementation::Sequence<sequence...>, const Vector<otherSize, T>& a, T value) {
return {sequence < otherSize ? a[sequence] : value...};
}
template<std::size_t ...sequence> constexpr Vector<size, T> flippedInternal(Corrade::Containers::Implementation::Sequence<sequence...>) const {
template<std::size_t ...sequence> constexpr Vector<size, T> flippedInternal(Containers::Implementation::Sequence<sequence...>) const {
return {_data[size - 1 - sequence]...};
}
};
@ -1249,32 +1250,32 @@ operator/(const Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b)
#ifndef CORRADE_SINGLES_NO_DEBUG
/** @debugoperator{Vector} */
template<std::size_t size, class T> Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Vector<size, T>& value) {
template<std::size_t size, class T> Debug& operator<<(Debug& debug, const Vector<size, T>& value) {
/** @todo might make sense to propagate the flags also, for hex value
printing etc */
const bool packed = debug.immediateFlags() >= Corrade::Utility::Debug::Flag::Packed;
debug << (packed ? "{" : "Vector(") << Corrade::Utility::Debug::nospace;
const bool packed = debug.immediateFlags() >= Debug::Flag::Packed;
debug << (packed ? "{" : "Vector(") << Debug::nospace;
for(std::size_t i = 0; i != size; ++i) {
if(i != 0) debug << Corrade::Utility::Debug::nospace << ",";
if(i != 0) debug << Debug::nospace << ",";
debug << value[i];
}
return debug << Corrade::Utility::Debug::nospace << (packed ? "}" : ")");
return debug << Debug::nospace << (packed ? "}" : ")");
}
/* Explicit instantiation for commonly used types */
#ifndef DOXYGEN_GENERATING_OUTPUT
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<2, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<3, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<4, Float>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<2, Int>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<3, Int>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<4, Int>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<2, UnsignedInt>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<3, UnsignedInt>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<4, UnsignedInt>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<2, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<3, Double>&);
extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<4, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<2, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<3, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<4, Float>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<2, Int>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<3, Int>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<4, Int>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<2, UnsignedInt>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<3, UnsignedInt>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<4, UnsignedInt>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<2, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<3, Double>&);
extern template MAGNUM_EXPORT Debug& operator<<(Debug&, const Vector<4, Double>&);
#endif
#endif

166
src/Magnum/Math/instantiation.cpp

@ -102,39 +102,39 @@ template struct MAGNUM_EXPORT_TEMPLATE ConfigurationValue<Magnum::Math::DualQuat
namespace Magnum { namespace Math {
#ifndef DOXYGEN_GENERATING_OUTPUT
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<2, 2, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<2, 3, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<3, 2, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<3, 3, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<2, 2, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<2, 3, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<3, 2, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Bezier<3, 3, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector2<Float>>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector3<Float>>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector2<Double>>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Vector3<Double>>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Complex<Float>>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Complex<Double>>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Quaternion<Float>>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const CubicHermite<Quaternion<Double>>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Complex<Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Complex<Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualComplex<Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualComplex<Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualQuaternion<Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const DualQuaternion<Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Quaternion<Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Quaternion<Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const ColorHsv<Float>&);
template Debug& operator<<(Debug&, const Bezier<2, 2, Float>&);
template Debug& operator<<(Debug&, const Bezier<2, 3, Float>&);
template Debug& operator<<(Debug&, const Bezier<3, 2, Float>&);
template Debug& operator<<(Debug&, const Bezier<3, 3, Float>&);
template Debug& operator<<(Debug&, const Bezier<2, 2, Double>&);
template Debug& operator<<(Debug&, const Bezier<2, 3, Double>&);
template Debug& operator<<(Debug&, const Bezier<3, 2, Double>&);
template Debug& operator<<(Debug&, const Bezier<3, 3, Double>&);
template Debug& operator<<(Debug&, const CubicHermite<Float>&);
template Debug& operator<<(Debug&, const CubicHermite<Double>&);
template Debug& operator<<(Debug&, const CubicHermite<Vector2<Float>>&);
template Debug& operator<<(Debug&, const CubicHermite<Vector3<Float>>&);
template Debug& operator<<(Debug&, const CubicHermite<Vector2<Double>>&);
template Debug& operator<<(Debug&, const CubicHermite<Vector3<Double>>&);
template Debug& operator<<(Debug&, const CubicHermite<Complex<Float>>&);
template Debug& operator<<(Debug&, const CubicHermite<Complex<Double>>&);
template Debug& operator<<(Debug&, const CubicHermite<Quaternion<Float>>&);
template Debug& operator<<(Debug&, const CubicHermite<Quaternion<Double>>&);
template Debug& operator<<(Debug&, const Complex<Float>&);
template Debug& operator<<(Debug&, const Complex<Double>&);
template Debug& operator<<(Debug&, const DualComplex<Float>&);
template Debug& operator<<(Debug&, const DualComplex<Double>&);
template Debug& operator<<(Debug&, const DualQuaternion<Float>&);
template Debug& operator<<(Debug&, const DualQuaternion<Double>&);
template Debug& operator<<(Debug&, const Quaternion<Float>&);
template Debug& operator<<(Debug&, const Quaternion<Double>&);
template Debug& operator<<(Debug&, const ColorHsv<Float>&);
/* Check proper size of GL types */
static_assert(sizeof(Vector<2, Float>) == 8, "Improper size of 2-element Float vector");
@ -170,56 +170,56 @@ static_assert(sizeof(RectangularMatrix<4, 2, Double>) == 64, "Improper size of 4
static_assert(sizeof(RectangularMatrix<3, 4, Double>) == 96, "Improper size of 3x4 Double matrix");
static_assert(sizeof(RectangularMatrix<4, 3, Double>) == 96, "Improper size of 4x3 Double matrix");
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 2, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 3, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 4, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 2, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 3, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 4, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 3, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 2, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 4, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 2, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 4, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 3, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 3, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 2, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<2, 4, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 2, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<3, 4, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const RectangularMatrix<4, 3, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Unit<Rad, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Unit<Deg, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Unit<Rad, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Unit<Deg, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<2, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<3, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<4, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<2, Int>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<3, Int>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<4, Int>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<2, UnsignedInt>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<3, UnsignedInt>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<4, UnsignedInt>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<2, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<3, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Vector<4, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Frustum<Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Frustum<Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<1, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<2, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<3, Float>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<1, Int>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<2, Int>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<3, Int>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<1, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<2, Double>&);
template Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug&, const Range<3, Double>&);
template Debug& operator<<(Debug&, const RectangularMatrix<2, 2, Float>&);
template Debug& operator<<(Debug&, const RectangularMatrix<3, 3, Float>&);
template Debug& operator<<(Debug&, const RectangularMatrix<4, 4, Float>&);
template Debug& operator<<(Debug&, const RectangularMatrix<2, 2, Double>&);
template Debug& operator<<(Debug&, const RectangularMatrix<3, 3, Double>&);
template Debug& operator<<(Debug&, const RectangularMatrix<4, 4, Double>&);
template Debug& operator<<(Debug&, const RectangularMatrix<2, 3, Float>&);
template Debug& operator<<(Debug&, const RectangularMatrix<3, 2, Float>&);
template Debug& operator<<(Debug&, const RectangularMatrix<2, 4, Float>&);
template Debug& operator<<(Debug&, const RectangularMatrix<4, 2, Float>&);
template Debug& operator<<(Debug&, const RectangularMatrix<3, 4, Float>&);
template Debug& operator<<(Debug&, const RectangularMatrix<4, 3, Float>&);
template Debug& operator<<(Debug&, const RectangularMatrix<2, 3, Double>&);
template Debug& operator<<(Debug&, const RectangularMatrix<3, 2, Double>&);
template Debug& operator<<(Debug&, const RectangularMatrix<2, 4, Double>&);
template Debug& operator<<(Debug&, const RectangularMatrix<4, 2, Double>&);
template Debug& operator<<(Debug&, const RectangularMatrix<3, 4, Double>&);
template Debug& operator<<(Debug&, const RectangularMatrix<4, 3, Double>&);
template Debug& operator<<(Debug&, const Unit<Rad, Float>&);
template Debug& operator<<(Debug&, const Unit<Deg, Float>&);
template Debug& operator<<(Debug&, const Unit<Rad, Double>&);
template Debug& operator<<(Debug&, const Unit<Deg, Double>&);
template Debug& operator<<(Debug&, const Vector<2, Float>&);
template Debug& operator<<(Debug&, const Vector<3, Float>&);
template Debug& operator<<(Debug&, const Vector<4, Float>&);
template Debug& operator<<(Debug&, const Vector<2, Int>&);
template Debug& operator<<(Debug&, const Vector<3, Int>&);
template Debug& operator<<(Debug&, const Vector<4, Int>&);
template Debug& operator<<(Debug&, const Vector<2, UnsignedInt>&);
template Debug& operator<<(Debug&, const Vector<3, UnsignedInt>&);
template Debug& operator<<(Debug&, const Vector<4, UnsignedInt>&);
template Debug& operator<<(Debug&, const Vector<2, Double>&);
template Debug& operator<<(Debug&, const Vector<3, Double>&);
template Debug& operator<<(Debug&, const Vector<4, Double>&);
template Debug& operator<<(Debug&, const Frustum<Float>&);
template Debug& operator<<(Debug&, const Frustum<Double>&);
template Debug& operator<<(Debug&, const Range<1, Float>&);
template Debug& operator<<(Debug&, const Range<2, Float>&);
template Debug& operator<<(Debug&, const Range<3, Float>&);
template Debug& operator<<(Debug&, const Range<1, Int>&);
template Debug& operator<<(Debug&, const Range<2, Int>&);
template Debug& operator<<(Debug&, const Range<3, Int>&);
template Debug& operator<<(Debug&, const Range<1, Double>&);
template Debug& operator<<(Debug&, const Range<2, Double>&);
template Debug& operator<<(Debug&, const Range<3, Double>&);
#endif
}}

Loading…
Cancel
Save