Vladimír Vondruš
22b846e2e8
Math: ability to construct vectors and matrices from sized arrays.
...
Same as done for Containers::StaticArray some time ago. Since it's not a
potentially dangerous operation, it's not made as an overload of the
from() function, but instead a regular constructor. It's however kept
explicit for now, even though it eventually might not need to be -- I'm
not sure about potential consequences yet.
2 years ago
Vladimír Vondruš
fe0b470d73
Math: doc++
2 years ago
Vladimír Vondruš
0aff2ec600
Math: make the external conversion SFINAE template arguments unnamed.
...
It's like this in Corrade::Containers already, the reason it was still
named here is probably just historical.
2 years ago
Vladimír Vondruš
2619dc33f1
doc: drop the redundant Magnum prefix from snippet files.
...
I accidentally did that at first, and then "for consistency" continued
with that for a decade.
2 years ago
Vladimír Vondruš
cda89edcbd
Math: further clarify orthonormal matrix vs orthogonal matrix.
2 years ago
Vladimír Vondruš
4c21575045
Math: fix Matrix::isOrthogonal() to catch negative dot product values.
...
Also adjusting two tests which were calling rotation() on matrices that
actually didn't have a correct rotation part, and it only slipped
through because of the bug in isOrthogonal().
Co-authored-by: John Turner <7strbass@gmail.com>
2 years ago
Vladimír Vondruš
5e097681cb
Math: be reasonable, <utility> is not needed for std::declval.
...
Despite what the standard tries to say. I bet a large portion of
<type_traits> is impossible to implement without it, which is why all
STL implementations define it there already.
3 years ago
Vladimír Vondruš
4825ed0608
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.
3 years ago
Vladimír Vondruš
fa079385bf
singles: don't include StrictWeakOrdering in MagnumMath.hpp.
3 years ago
Vladimír Vondruš
bbb54a9df8
It's 2023 already!
3 years ago
Vladimír Vondruš
be9a3c247d
Math: change all assertions to debug-only.
...
The perf cost is just too great for these to be enabled always. The only
place where the assertions are kept always is in the batch APIs -- there
it's assumed the function is called on large enough data to offset this
overhead, plus since it's often dealing with large blocks of data the
memory safety is more important than various FP drifts which were the
usual case why other assertions were firing.
3 years ago
Vladimír Vondruš
dfe37f61d1
Math: redo Matrix4::normalMatrix() as an inverse transpose.
...
The article this API was originally based on assumes a scenario which
just *isn't* matching usual practices here, giving wrong results. Too
bad I didn't spend more time questioning the proof there and just
blindly assumed it's correct because everyone said so.
Won't be typing all that reasoning again in the commit message, see the
changelog entry and the comment in the test for details.
3 years ago
Vladimír Vondruš
822fa0d644
Updated copyright year.
4 years ago
Vladimír Vondruš
3697125c7d
Math: disallow reflections in {Complex,Quaternion}::fromMatrix().
...
And update docs in Matrix[34]::rotation() and related functions to note
this. This is a breaking change that may cause existing code to start
asserting.
5 years ago
Vladimír Vondruš
57ae596d88
Math: don't call into RectangularMatrix privates from Matrix.
...
Yes, it's one function call more this way, but it's cleaner and without
duplicated code that's prone to bugs.
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š
a347a2b3bd
Math: make it possible to create an identity RectangularMatrix as well.
5 years ago
Vladimír Vondruš
7413d2053f
Math: doc++
5 years ago
Vladimír Vondruš
3d136503d8
Updated copyright year.
5 years ago
Vladimír Vondruš
5a1f43f20b
Switch to the new & optimized GenerateSequence from Corrade.
...
This should help slightly with compiler memory usage, on GCC 10 the huge
Trade::MaterialData test used "only" 309 instead of 318 MB after this
change.
5 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š
22118c754d
Math: attempt to deconfuse orthogonalization/orthonormalization a bit.
6 years ago
Vladimír Vondruš
f74fd5cb08
Add typedefs for half-float and 8-/16-bit packed matrices.
6 years ago
Vladimír Vondruš
a920722839
doc: label deprecated APIs and stuff new since 2019.10 with version info.
...
Should make new things more discoverable, avoid confusion when a
documented API isn't there and reduce the need for maintaining multiple
separate versions of the docs.
7 years ago
Vladimír Vondruš
de3f8858f0
Math: now that we have a standalone cofactor(), inline its internals.
...
Apparently this gives a nearly three-times speed up compared to before.
Didn't expect that.
Starting Magnum::Math::Test::MatrixBenchmark with 16 test cases...
INFO Benchmarking a debug build.
BENCH [01] 95.33 ± 4.52 ns multiply3()@499x10000 (wall time)
BENCH [02] 183.99 ± 9.29 ns multiply4()@499x10000 (wall time)
BENCH [03] 110.17 ± 8.50 ns comatrix3()@49x10000 (wall time)
BENCH [04] 161.54 ± 10.13 ns invert3()@49x10000 (wall time)
BENCH [05] 471.44 ± 19.40 ns invert3GaussJordan()@49x10000 (wall time)
BENCH [06] 320.65 ± 13.23 ns invert3Rigid()@49x10000 (wall time)
BENCH [07] 206.27 ± 9.80 ns invert3Orthogonal()@49x10000 (wall time)
BENCH [08] 321.25 ± 18.82 ns comatrix4()@49x10000 (wall time)
BENCH [09] 445.50 ± 15.18 ns invert4()@49x10000 (wall time)
BENCH [10] 828.55 ± 16.96 ns invert4GaussJordan()@49x10000 (wall time)
BENCH [11] 533.23 ± 21.75 ns invert4Rigid()@49x10000 (wall time)
BENCH [12] 345.56 ± 10.16 ns invert4Orthogonal()@49x10000 (wall time)
BENCH [13] 63.72 ± 6.85 ns transformVector3()@999x10000 (wall time)
BENCH [14] 62.28 ± 4.43 ns transformPoint3()@999x10000 (wall time)
BENCH [15] 82.05 ± 7.96 ns transformVector4()@999x10000 (wall time)
BENCH [16] 79.32 ± 2.41 ns transformPoint4()@999x10000 (wall time)
Finished Magnum::Math::Test::MatrixBenchmark with 0 errors out of 5500 checks.
7 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š
4b4b8efc1b
Math: doc++
...
Fixing Engrish while doing the Python bindings.
7 years ago
Vladimír Vondruš
3fb90cdf5c
Math: remove obsolete Doxygen workarounds.
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š
b61f8262e9
Math: inline a helper function.
7 years ago
Vladimír Vondruš
e4e90bd75c
Math: explicitly specialize 3x3 matrix determinant.
...
Together with the operator[] deinilining that makes matrix inverse
almost six times faster than before. Now 2x faster in debug builds than
GLM (was 3x slower before).
7 years ago
Vladimír Vondruš
05b1cefda5
Math: avoid operator[] calls where possible (and not too verbose).
...
In debug builds (where nothing is inlined), this makes matrix
multiplication run in 33% of the time and matrix inversion roughly twice
as fast.
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š
5fc246b908
Math: compile forgotten code snippets.
7 years ago
Vladimír Vondruš
e6b7aa12fa
Updated copyright year.
7 years ago
Vladimír Vondruš
f5e30bb5d3
Math: minor coding style cleanup.
8 years ago
Borislav Stanimirov
f7f2ab8cb5
Math: added StrictWeakOrdering for math types
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š
eabe118266
Math: doc++
8 years ago
Vladimír Vondruš
ddde4a3277
Math: removed long-deprecated Matrix::Identity and Matrix::Zero tags.
...
Use Math::IdentityInit and Math::ZeroInit instead.
8 years ago
Vladimír Vondruš
2136466f0f
Math: doc++, add search aliases for GLSL functions.
8 years ago
Vladimír Vondruš
623fa97970
Updated copyright year.
8 years ago
Vladimír Vondruš
05bb8b419a
Math: updates for the new documentation theme.
8 years ago
Vladimír Vondruš
7a16273e5d
Updated copyright year.
9 years ago
Vladimír Vondruš
ae9095de16
Remove most of the "MSVC 2015 can't handle {} here" workarounds.
9 years ago
Vladimír Vondruš
025ef780b2
Workaround for that one damn Doxygen bug.
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š
6e10b2e205
Math: doc++
...
The TODOs were removed and put into GitHub projects to be a bit more
visible to random strangers.
9 years ago