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š
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š
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š
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š
15e5bfa09e
Update credits and changelog, minor cleanup.
7 years ago
Marco Melorio
097289850a
Add toEuler() to Quaternion
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š
e3a820f468
Math: benchmark basic Matrix operations.
...
So I'm sure the next additions don't make things worse -- in the debug
build, in particular. Current state:
Starting Magnum::Math::Test::MatrixBenchmark with 14 test cases...
INFO Benchmarking a debug build.
BENCH [01] 102.25 ± 4.58 ns multiply3()@499x10000 (wall time)
BENCH [02] 183.84 ± 7.75 ns multiply4()@499x10000 (wall time)
BENCH [03] 329.84 ± 20.50 ns invert3()@49x10000 (wall time)
BENCH [04] 442.08 ± 13.47 ns invert3GaussJordan()@49x10000 (wall time)
BENCH [05] 331.23 ± 13.85 ns invert3Rigid()@49x10000 (wall time)
BENCH [06] 206.01 ± 11.13 ns invert3Orthogonal()@49x10000 (wall time)
BENCH [07] 1.01 ± 0.03 µs invert4()@49x10000 (wall time)
BENCH [08] 826.77 ± 19.33 ns invert4GaussJordan()@49x10000 (wall time)
BENCH [09] 520.12 ± 21.97 ns invert4Rigid()@49x10000 (wall time)
BENCH [10] 344.20 ± 13.32 ns invert4Orthogonal()@49x10000 (wall time)
BENCH [11] 61.00 ± 2.89 ns transformVector3()@999x10000 (wall time)
BENCH [12] 61.55 ± 3.35 ns transformPoint3()@999x10000 (wall time)
BENCH [13] 80.65 ± 2.99 ns transformVector4()@999x10000 (wall time)
BENCH [14] 80.86 ± 3.32 ns transformPoint4()@999x10000 (wall time)
Finished Magnum::Math::Test::MatrixBenchmark with 0 errors out of 5400 checks.
7 years ago
Vladimír Vondruš
7f70dc7385
Math: XFAIL most (all?) NoInit tests in Release builds.
7 years ago
Vladimír Vondruš
17b3c8fac5
Math: support numeric indexing in gather() / scatter() as well.
7 years ago
Vladimír Vondruš
acc8d8994b
Math: added scatter(), renamed swizzle() to gather().
...
The swizzle() function is still present, only marked as deprecated and
scheduled to be removed in some future release.
7 years ago
Vladimír Vondruš
4bc84f6815
Math: expand UnderlyingTypeOf to support vectors and matrices.
...
This allows getting underlying type of those without needing to include
them. Yay.
7 years ago
Vladimír Vondruš
1887fe0ab9
Math: added a scalar equal() / notEqual() variant.
7 years ago
Vladimír Vondruš
13b4bf8461
Math: use __builtin_sincos for sincos() on GCC.
...
Makes this thing faster on Debug. But I'm not sure whether it's due to
less function calls or this intrinsic being actually faster, heh.
Probably a combination of both.
7 years ago
Vladimír Vondruš
a28e14491c
Math: verify that TypeTraits work correctly for signed infinities.
7 years ago
Vladimír Vondruš
3cf9dbf409
Math: added component-wise equal()/notEqual() for vectors.
7 years ago
Vladimír Vondruš
3d5f50ac49
Test: use the new setTestCaseTemplateName().
7 years ago
Vladimír Vondruš
a1cc0cb62d
Math: off-center Matrix4::perspectiveProjection().
7 years ago
Vladimír Vondruš
8e5ecfacac
Math: ignore NaNs also in Vector::min(), max() and minmax().
...
To have the API consistent.
7 years ago
Vladimír Vondruš
46fdb38cd2
Math: make batch min() / max() / minmax() ignore NaNs.
7 years ago
Vladimír Vondruš
d38303505d
Math: added batch isInf() and isNan().
7 years ago
Vladimír Vondruš
da43af403e
Math: minor cleanup and code simplification.
7 years ago
Vladimír Vondruš
28f12f9a5e
Math: improve the NaN propagation tests even more.
7 years ago
Vladimír Vondruš
75ffd39fe0
Math: make it possible to use Deg/Rad in all functions.
...
This should have been here ages ago, haha.
7 years ago
Vladimír Vondruš
7941a769cd
Math: added IsUnitless type trait.
7 years ago
Vladimír Vondruš
19844352ff
Math: added UnderlyingTypeOf.
7 years ago
Vladimír Vondruš
aa2adb7222
Math: add IsScalar, IsVector, IsIntegral and IsFloatingPoint type traits.
...
The standard ones are not good enough, so let's roll out my own.
7 years ago
Vladimír Vondruš
442d5576d0
Math: change the way BoolVector is printed to Debug.
...
Found while working on the Python bindings --- BoolVector4(0b1010) got
printed as BoolVector(0101), which is totally confusing. Now it prints
it in a way that looks exactly the same as when constructing the vector
with binary literals.
7 years ago
Vladimír Vondruš
4b6fabb004
Math: ability to Debug colors as actual colored squares.
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š
f8b9c69b16
Don't use std::tie() on std::pair().
...
It's nice and all, but including the whole <tuple> just for that is not
worth it.
7 years ago
Vladimír Vondruš
8c1d62d97c
Math: use CORRADE_TARGET_EMSCRIPTEN instead of MAGNUM_TARGET_WEBGL.
...
When WebGPU is here, what would we gonna do?
7 years ago
Vladimír Vondruš
754c84525e
The <cmath> header is not allowed anymore.
7 years ago
Vladimír Vondruš
0dd763fe9d
Math: fix deprecated build.
7 years ago
Vladimír Vondruš
53c1549e69
Math: deprecate Frustum::planes() in favor of begin()/end().
...
This allows us to get rid of the StaticArrayView, which is the last
roadblock on the way to a single-header math. The planes() are now
deprecated, along with the include, and will get removed in a future
release.
7 years ago
Vladimír Vondruš
8079cda8aa
Math: check for OOB access in Frustum::operator[]().
7 years ago
Vladimír Vondruš
3a1713d549
Math: no need to include <tuple> just for std::tie() in tests.
...
Unpack the pairs manually instead.
7 years ago
Vladimír Vondruš
c12680ec38
Math: move batch functionality to FunctionsBatch.h.
...
Avoids including a (relatively) large ArrayView in Functions.h. Yes,
we are now at a point where 500 lines matter.
7 years ago
Vladimír Vondruš
547a3f3cea
Math: use a dedicated type for HSV colors instead of a tuple.
...
Pros:
* faster compile times (#include <tuple> is 13k lines, ugh)
* ability to have NoInit and ZeroInit constructors
* ability to do fuzzy compare
* named members, so we don't have to use mutable std::tie()
Cons:
* ... none?
The old Color[34]::Hsv is still a tuple and the new ColorHsv is
convertible to/from it (and even std::tie() works). These are all
deprecated (along with the <tuple> include).
7 years ago
Vladimír Vondruš
e7af6bf07b
Math: minor cleanup and code shuffling.
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š
b24ffa4a3e
Use min() / max() / minmax() from Math instead of std::.
...
First step to avoid the <algorithm> header.
7 years ago
Vladimír Vondruš
71c90e6024
Math: fix MSVC integer conversion warnings in a test.
7 years ago
Vladimír Vondruš
9a8e874eb4
Math: minor cleanup.
7 years ago
Vladimír Vondruš
5a010269bd
Math: implement component-wise bool operations on BoolVector.
7 years ago
Vladimír Vondruš
e75c7639e7
Math: test Matrix[34]::scalingSquared().
7 years ago