Stanislaw Halik
c1578c0d79
Math: workaround MSVC2022 bug with constexpr conversions and C++20
...
Upstream bugreport at https://developercommunity.visualstudio.com/t/MSVC-1933-fails-to-compile-valid-code-u/10185268
4 years ago
Vladimír Vondruš
6bdffb2796
Test: make use of CORRADE_SKIP_IF_NO_ASSERT().
4 years ago
Vladimír Vondruš
9874c44262
Don't rely on __GNUC__ being always 4 on Clang.
...
Certain Clang-based IDEs (CLion) "emulate" a compiler by inheriting all
its defines, which means one gets __clang__ defined but also __GNUC__
set to 11 or whatever, breaking all these assumptions.
4 years ago
Vladimír Vondruš
822fa0d644
Updated copyright year.
4 years ago
Vladimír Vondruš
5c6b98391d
Math,DebugTools: adapt tests for Android differences in NaN printing.
...
What a waste of energy. I need my own float printing code already.
4 years ago
Vladimír Vondruš
ff1b0ab307
Math: add off-center variants of 2D/3D orthographic projection as well.
...
Was just perspective projection right now.
5 years ago
Vladimír Vondruš
dd3ce93888
Math: MSVC 2015, you ICEd.
5 years ago
Vladimír Vondruš
08a6e7d957
Math: explicit test that all types are trivially copyable.
...
I saw some copy constructors here and there and wasn't sure.
5 years ago
Vladimír Vondruš
7072befbdb
Math: generalize slicing and expanding to arbitrarily-sized matrices.
...
Originally was done only for square matrices, but now I need that for
converting 3x3 -> 3x4 and back (UBO packing, ugh ugh), so let's
generalize.
5 years ago
Vladimír Vondruš
ed9deff432
Test: adapt to a less shitty CORRADE_COMPARE().
5 years ago
Vladimír Vondruš
3d136503d8
Updated copyright year.
5 years ago
Vladimír Vondruš
e6322dcfd1
Math: use angle literals in all test code.
...
It was originally done using the Deg() / Rad() constructors in order to
be compatible with GCC 4.6, but fortunately those days are long gone.
Co-authored-by: Squareys <squareys@googlemail.com>
6 years ago
Vladimír Vondruš
ca8172311d
Math: FFS, GCC.
6 years ago
Vladimír Vondruš
12577ce07f
Math: verify normal matrix calculation against the ground truth code.
...
It gives the same result, nevertheless something is not right when it
comes to negatively scaled meshes. Postponing the rest of the
investigation to later.
6 years ago
Vladimír Vondruš
1026aee80e
Moved the NoInit tag from Math to the root namespace.
...
The old one is deprecated, and will be removed in a future release.
Unfortunately, to avoid deprecation warnings, all use of NoInit in the
Math library temporarily have to be Magnum::NoInit This will be cleaned
up when the deprecated alias is removed.
6 years ago
Vladimír Vondruš
19e0e96d74
Updated copyright year.
6 years ago
Vladimír Vondruš
65a2ced2a7
Make this compile and test cleanly with CORRADE_NO_ASSERT defined.
6 years ago
Vladimír Vondruš
c85b537937
Revert "Math: preserve signs in the Matrix[34]::scaling() getter."
...
Turns out this seriously broke properites that should always hold, such
as that R*S = M for a R and S extracted out of M. Another way to fix
this would be flipping signs in the rotation() / rotationShear() / ...
queries as well, but that adds extra operations to both rotation() and
scaling() and at that point it's just better to do what was done the
whole decade before.
To ensure this doesn't happen again and doesn't cost me a whole day of
debugging in an end-user app (SceneGraph TRS transformations got broken
because those assume that rotation() and scaling() *do* combine back,
which is a reasonable thing to assume), the docs are extended to note
this and there's an explicit test for both negative scale and large
angle corner cases as well.
This reverts commit 9aa68715db .
6 years ago
Vladimír Vondruš
9aa68715db
Math: preserve signs in the Matrix[34]::scaling() getter.
...
This is a breaking change, but I think it is worth doing. Because now
Matrix4::scaling(vec).scaling() == vec
which was true also for translation and other.
6 years ago
Vladimír Vondruš
515637c76a
Math: implement a robust and faster Matrix4::normalMatrix().
...
This change makes the operations split into a bunch of separate
functions, making the parts easier to document, however with a slight
negative effect on debug performance:
Starting Magnum::Math::Test::MatrixBenchmark with 16 test cases...
INFO Benchmarking a debug build.
BENCH [01] 94.54 ± 3.62 ns multiply3()@499x10000 (wall time)
BENCH [02] 183.47 ± 7.50 ns multiply4()@499x10000 (wall time)
BENCH [03] 318.11 ± 11.59 ns comatrix3()@49x10000 (wall time)
BENCH [04] 379.51 ± 12.17 ns invert3()@49x10000 (wall time)
BENCH [05] 448.23 ± 17.61 ns invert3GaussJordan()@49x10000 (wall time)
BENCH [06] 338.96 ± 11.61 ns invert3Rigid()@49x10000 (wall time)
BENCH [07] 206.37 ± 10.59 ns invert3Orthogonal()@49x10000 (wall time)
BENCH [08] 879.40 ± 20.03 ns comatrix4()@49x10000 (wall time)
BENCH [09] 1.16 ± 0.03 µs invert4()@49x10000 (wall time)
BENCH [10] 825.40 ± 17.34 ns invert4GaussJordan()@49x10000 (wall time)
BENCH [11] 534.86 ± 15.73 ns invert4Rigid()@49x10000 (wall time)
BENCH [12] 347.36 ± 11.62 ns invert4Orthogonal()@49x10000 (wall time)
BENCH [13] 65.70 ± 6.73 ns transformVector3()@999x10000 (wall time)
BENCH [14] 62.56 ± 3.09 ns transformPoint3()@999x10000 (wall time)
BENCH [15] 81.25 ± 2.78 ns transformVector4()@999x10000 (wall time)
BENCH [16] 82.14 ± 4.26 ns transformPoint4()@999x10000 (wall time)
Finished Magnum::Math::Test::MatrixBenchmark with 0 errors out of 5500 checks.
7 years ago
Vladimír Vondruš
a1cc0cb62d
Math: off-center Matrix4::perspectiveProjection().
7 years ago
Vladimír Vondruš
36ba5f4333
Math: ensure ZeroInit and IdentityInit constructors are explicit.
...
Like NoInit ones. Not sure what I was doing there.
7 years ago
Vladimír Vondruš
3626562e1d
Adapted to Corrade changes.
...
Mostly missing includes now.
7 years ago
Vladimír Vondruš
64bc7f9c8e
Math: moved configuration value parsers to a dedicated header.
...
There's a lot of string operations and that's nothing good to have
included everywhere. Should speed up the compilation quite a bit.
7 years ago
Vladimír Vondruš
e75c7639e7
Math: test Matrix[34]::scalingSquared().
7 years ago
Vladimír Vondruš
2149f7b869
Wrap all tests in unnamed namespaces.
...
This makes the compiler warn about test cases that aren't ever used,
which is a good thing.
7 years ago
Vladimír Vondruš
e6b7aa12fa
Updated copyright year.
7 years ago
Vladimír Vondruš
3e3eb21181
Math: correct order for test implementations.
8 years ago
Borislav Stanimirov
f7f2ab8cb5
Math: added StrictWeakOrdering for math types
8 years ago
Vladimír Vondruš
5792d7f06a
Math: fun with printing NaNs :(
8 years ago
Vladimír Vondruš
0cf65741ae
Math: helpfully print the offending values in all assertions.
8 years ago
Vladimír Vondruš
8d5454b8ff
Math: ability to slice or expand square matrices.
8 years ago
Vladimír Vondruš
fbd3dedeb3
Math: add Matrix[34]::rotationShear(), scalingSquared() and scaling().
...
Important: the rotation() accessor now allows non-uniform scaling but
expects orthogonality (previously it allowed non-orthogonal rotation
axes but disallowed non-uniform scaling).
Documentation of all these accessors is further improved now as well.
8 years ago
Vladimír Vondruš
7df90af144
Math: work around MSVC 2017 15.7.2 ICEs.
...
Reported here:
https://developercommunity.visualstudio.com/content/problem/259204/1572-regression-ice-in-constexpr-code-involving-de.html
8 years ago
Vladimír Vondruš
623fa97970
Updated copyright year.
8 years ago
Vladimír Vondruš
7a16273e5d
Updated copyright year.
9 years ago
Vladimír Vondruš
aa69bbcc19
Math: ability to create matrices with one value for all components.
...
In order to do that with the previous API, one had to write an
abomination like
auto a = Matrix4x4::fromVector(Math::Vector<16, Float>{0.5f});
Ugh.
9 years ago
Vladimír Vondruš
70ef473710
Math: verify that the NoInit constructors are explicit.
10 years ago
Vladimír Vondruš
a2c8435ede
Use new TestSuite numeric comparators where appropriate.
10 years ago
Vladimír Vondruš
6422a27b46
Math: improve Matrix4::lookAt() test.
...
It now verifies all assumptions about how the resulting matrix should
look like.
10 years ago
Vladimír Vondruš
e9a2623e02
Math: expect NoInit test failures on GCC 6.1+ with optimizations enabled.
...
It's nothing harmful, just inefficient.
10 years ago
Vladimír Vondruš
87074202c8
Math: support infinite far plane in Matrix::perspectiveProjection().
10 years ago
Vladimír Vondruš
40d60f6a3f
Math: make all constructor noexcept and test their behavior.
10 years ago
Vladimír Vondruš
288a1f265c
Math: this shouldn't have been here.
...
Fixes test failures on *all* platforms. Ha!
10 years ago
Vladimír Vondruš
c2d2737ca6
Math: test and document Matrix4::*projection() harder.
10 years ago
Vladimír Vondruš
41253de1d5
Math: make Matrix4::transformPoint() work with projection matrices.
...
Dividing by w instead of ignoring it.
10 years ago
Vladimír Vondruš
23646e6690
Hell, this project is big.
10 years ago
Vladimír Vondruš
30fc1411bb
Adapted to Corrade changes.
10 years ago
Vladimír Vondruš
d7e507a2a7
MSVC 2015 compatibility: Math copy/conversion constexpr issues.
...
I don't know why, but marking the output of copy constructor of any
subclass or output of conversion operator of any class as constexpr
causes MSVC to complain about non-constant expression.
Probably just another bug.
11 years ago
Vladimír Vondruš
350d820823
Math: cleanup.
11 years ago