Vladimír Vondruš
f74fd5cb08
Add typedefs for half-float and 8-/16-bit packed matrices.
6 years ago
Vladimír Vondruš
881003d90b
Test: adapt tests to change in TestSuite float epsilon precisions.
6 years ago
Vladimír Vondruš
ab0cba2573
Math: minor cleanup.
6 years ago
Vladimír Vondruš
53151f606a
Math: ensure TypeTraits fuzzy compare is consistent with TestSuite.
...
It wasn't until now (TestSuite was wrong), so prevent similar issues
from happening in the future.
6 years ago
Vladimír Vondruš
526254912e
doc: updated credits and changelog.
6 years ago
Squareys
a0e6ac1ed0
Math: Non-const overloads for Frustum::(left|right|top|bottom|near|far|[])
...
Signed-off-by: Squareys <squareys@googlemail.com>
6 years ago
Vladimír Vondruš
d2513cac3c
Math: make Color default alpha values work with Half.
...
There's some fugliness needed for the MSVC 2017 crash workaround but
otherwise all good.
6 years ago
Vladimír Vondruš
c8afe0f732
Math: make Vector::pad() default argument work with Half.
...
Got lucky enough that the default zero-initialization constructor does
exactly what I need. Otherwise ugh I don't know what I would do.
6 years ago
Vladimír Vondruš
50e21015eb
Math: make it possible to construct Half from a double.
...
A lot of generic code uses T(1.0) and right now that caused an ambiguity
between the Float and UnsignedShort constructors.
6 years ago
Vladimír Vondruš
10dd468eca
Math: minimal support for Half in TypeTraits.
6 years ago
Vladimír Vondruš
3734568cdf
Math: switch to our type traits in Color internals.
...
In preparation for having the Half type usable in Color.
6 years ago
Vladimír Vondruš
f5a5e10c50
Math: batch table-based half-float packing/unpacking.
...
It's a lot of code, but it still seems to be the fastest option of all
we have. This was the original idea when implementing half-float support
in 2016 but then I shelved it in favor of a simpler (but slower) code,
keeping the table only for the benchmark, calculated at runtime. But now
we need a batch version of this, so this comes handy.
6 years ago
Vladimír Vondruš
69e370c4c7
GCC 4.8, happy to see you're still around, causing problems.
6 years ago
Vladimír Vondruš
88fabb1ef6
Math: reduce header dependencies a bit.
6 years ago
Vladimír Vondruš
daf471381e
Math: add batch integer packing/unpacking and casting functions.
...
To be used for conversion of the upcoming mesh attribute types.
6 years ago
Vladimír Vondruš
73c37a8339
Add Vector[324][u][hsb] convenience typedefs for small types.
...
And also Color variants, to make it complete. No half types for matrices
right now, those might come later.
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š
a2118730a3
Math: fix a warning on 32bit MSVC.
6 years ago
Nghia Truong
1ef813fdad
Math: add reflect() and refract() functions.
...
Co-authored-by: Vladimír Vondruš <mosra@centrum.cz>
6 years ago
Vladimír Vondruš
b2328f57cd
Math: fall back to lerp when slerp'd quaternions are too close.
...
Returning just the first argument had several issues, one of them was
causing iterative interpolations to get stuck at the initial position
forever.
6 years ago
Vladimír Vondruš
c4a3b273e6
Math: provide transformVector() also on the DualThing classes.
...
To make them more consistent with Matrix3/4, making switching from one
to the other easier.
6 years ago
Vladimír Vondruš
ea92c5b36f
Math: clarify that implicit conversion of Foo to a DualFoo is rotation.
...
Had to remind myself about that.
6 years ago
Vladimír Vondruš
4490dfd68f
Math: use a degree symbol for hue ranges.
6 years ago
Vladimír Vondruš
bc99e6fa57
Math: improve docs for color (un)packing and sRGB conversion.
6 years ago
Vladimír Vondruš
73f776193d
Math: constexpr *is* inline.
6 years ago
Vladimír Vondruš
43f5f06956
Math: avoid warnings when calling length() on an integer Vector.
...
Also update the docs to hint the result may be imprecise on integer
types, and suggest Manhattan length as well.
6 years ago
Vladimír Vondruš
92b1cdf6b7
Math: pass strided array views by const&.
...
It has the size of three pointers, which is more than a little.
Unfortunately doing just that causes infinite recursion, so be a little
more specific when delegating from the overloads.
6 years ago
Vladimír Vondruš
a6dd63af0f
Math: make batch functions actually usable.
...
No longer it's needed to add ugly explicit template types or casts.
6 years ago
Vladimír Vondruš
742dc406fd
Math: don't include FunctionsBatch.h from Functions.h anymore.
...
These two got split in 2019.10 but one included the other for backwards
compat. It makes everything suffer from worse compile times, so not
doing that anymore.
6 years ago
Vladimír Vondruš
d69b6f8c40
Math: test and fix array-taking isInf()/isNan() also with vectors.
...
Next time I need to test properly.
6 years ago
Vladimír Vondruš
71b775aeb1
Math: minor test cleanup.
6 years ago
Vladimír Vondruš
d4f7c853ae
Math: make Constants::inf() work with clang-cl 8.
...
Using a similar workaround as for nan(). It works with version 9 tho.
6 years ago
Vladimír Vondruš
3b940f2509
doc: avoid referencing the deprecated Math::swizzle() function.
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š
6fbedd8f52
Revert "doc: pile on more Doxygen workarounds."
...
This reverts commit 0b7831c1ad .
6 years ago
Vladimír Vondruš
a19eb4e4a8
doc: DOXYGEN! WHAT THE HELL!
6 years ago
Vladimír Vondruš
c5dd075106
doc: Doxygen, what the hell.
6 years ago
Vladimír Vondruš
0b7831c1ad
doc: pile on more Doxygen workarounds.
...
Sad! https://github.com/doxygen/doxygen/issues/7472
6 years ago
Vladimír Vondruš
bec180fcf0
Doc++
6 years ago
Vladimír Vondruš
323829ac15
Work around clang-cl forgetting dllexport on extern templates.
6 years ago
Vladimír Vondruš
9bd7f306b5
Math: work around the NAN macro not being constexpr on clang-cl.
...
Y tho.
6 years ago
Vladimír Vondruš
1fb90813b1
doc: updated credits and changelog.
6 years ago
Vladimír Vondruš
376757bc6c
Doc++
6 years ago
Daniel Guzman
dd0fc3bcaf
Stop Magnum/Math/Swizzle.h(75): warning C4389: '==': signed/unsigned mismatch
6 years ago
Vladimír Vondruš
959ab7a444
Math: haha whoops.
7 years ago
Vladimír Vondruš
15e5bfa09e
Update credits and changelog, minor cleanup.
7 years ago
Marco Melorio
097289850a
Add toEuler() to Quaternion
7 years ago
Vladimír Vondruš
09e6145990
Math: improve Kahan Sum benchmark by comparing to doubles as well.
...
And reducing the overhead from the vector iterators by using an Array.
7 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