Vladimír Vondruš
c0a5e5dadd
Math: added sin(), cos() and tan() accepting either Rad or Deg.
13 years ago
Vladimír Vondruš
fec6822187
Math: added sqrt() scalar/vector overload.
13 years ago
Vladimír Vondruš
0144c38a54
Math: moved lerp() from Vector to Functions.h.
...
It does nothing special for vectors (unlike e.g. quaternion LERP) and
scalar overload is useful too.
13 years ago
Vladimír Vondruš
8a63939134
Math: added vector/scalar abs() function.
13 years ago
Vladimír Vondruš
263d8351b6
Math: vector overloads for normalize() and denormalize().
13 years ago
Vladimír Vondruš
4d6d3fde88
Math: scalar/vector implementation of min(), max() and clamp().
...
This is gonna be some ugly template hell.
13 years ago
Vladimír Vondruš
cade175304
Math: finally implemented precise signed/unsigned normalization.
...
(De)normalization from/to [0, 1] for unsigned types and from/to [-1, 1]
for signed types. -1.0 is always denormalized to min+1.
Also updated some tests for Color, as they depended on previous
imprecise implementation.
14 years ago
Vladimír Vondruš
7dc0fc4a4c
Math: Renamed Math.h to Functions.h
...
Math.h is reserved for forward declaration header.
14 years ago
Vladimír Vondruš
52300cf402
Math: function for base-2 logarithm.
...
Verbatim copy from Corrade, might be better to have it here too
(possibly some SIMD optimizations?).
14 years ago
Vladimír Vondruš
fcb8a7b768
Got rid of header files in tests.
...
They have no practical use and they only bloat codebase size and add
maintenance burden.
14 years ago
Vladimír Vondruš
0f889369f4
No `using namespace std` anywhere.
...
Also added missing std:: prefix to remaining cases of std::size_t,
std::[u]int[0-9]+_t, std::sin() etc., std::exit().
14 years ago
Vladimír Vondruš
c1cf94fb46
Using fixed-size integer types also everywhere else.
...
It solves issues with int/long int/long long int ambiguity, which is
good.
14 years ago
Vladimír Vondruš
eb803200d6
Disabled denormalization test for long double altogether.
...
Fails in Debug, but passes in Release mode on my GCC 4.7 @ x86_64. Not
sure what to do about it.
14 years ago
Vladimír Vondruš
3d77885555
Revert "Overflow test for large types in Math::normalize() started working."
...
It was working because of some weird state of my build dir, expecting
fail again.
This reverts commit 75d0505a60 .
14 years ago
Vladimír Vondruš
75d0505a60
Overflow test for large types in Math::normalize() started working.
...
I don't know what caused that... :-)
14 years ago
Vladimír Vondruš
fe62f547de
Reduced #includes in headers.
...
Magnum.h now doesn't include anything except OpenGL headers, thus
changes in Math library don't trigger recompilation of everything, but
only of things really depending on it.
Math constants moved to separate file for similar reasons, de-inlined
some functions to remove the need for some #includes.
14 years ago
Vladimír Vondruš
3558859cc6
Utility function for clamping value in given limits.
14 years ago
Vladimír Vondruš
51f2478b1e
More precise double Math constants.
...
Double has 15-17 significant decimal digits precision, extended
the constant to have 15 decimal digits. On the other hand, float has
only 6-9 digits, so there is no need to have more than 9.
Added just-to-be-sure test for sqrt* constants.
14 years ago
Vladimír Vondruš
3bcaed6322
Using round() in denormalization.
...
Gives more precise results for smaller types, but creates overflow for
large types.
14 years ago
Vladimír Vondruš
2553e50444
Functions for normalizing and denormalizing numeric values.
14 years ago
Vladimír Vondruš
27e1dce533
Got rid of Qt's QtTest in favor of Corrade's TestSuite.
...
Now we can use CORRADE_COMPARE() almost exclusively for comparing
Vector, Matrix instances and all containers from STL. Tests running time
for all 31 tests is now around 0.1 sec instead of two seconds like
before.
Disabled compilation of all benchmarks, because TestSuite cannot handle
them yet.
PKGBUILD from AUR now can shamelessly use check() function without
unnecessary dependencies.
14 years ago
Vladimír Vondruš
7f6f81afc7
Math::Constants are now inline functions instead of static variables.
...
Static variables were compiled into the library and then linked on
every use, which was not good for performance.
14 years ago
Vladimír Vondruš
925cc3d2ff
Make Math::pow() templated on type.
14 years ago
Vladimír Vondruš
f0d88fbf9f
Added templated Math::Constants structure to replace PI #define.
...
And added sqrt(2) and sqrt(3) constants while we are at it.
14 years ago
Vladimír Vondruš
c14715962d
Use T() instead of static_cast<T>() for numeric types.
14 years ago
Vladimír Vondruš
b945f5f68b
Happy New Year.
15 years ago
Vladimír Vondruš
e536c892c4
Added Math::pow() and Math::log() functions.
...
Math::pow() is templated on exponent, so it should be as fast as
possible (without recursion).
15 years ago
Vladimír Vondruš
e74168bb88
Added test for Math::deg() and Math::rad().
15 years ago
Vladimír Vondruš
8555475807
Support for printing Matrix and Vector to debug output.
...
Added tests for Matrix3, Vector2 just to be sure that debug output works
also there.
15 years ago
Vladimír Vondruš
c7b331d100
(Ahem...) Happy New Year!
15 years ago
Vladimír Vondruš
c41d6ad582
New namespace Magnum::Math.
16 years ago
Vladimír Vondruš
eeb12e3414
Vector3 class with additional functions for three-component vectors.
16 years ago
Vladimír Vondruš
2a2d8c3dd5
Template vector class.
16 years ago
Vladimír Vondruš
8f0bacd2f8
Function for transposing matrix.
16 years ago
Vladimír Vondruš
09d74422d9
Initial commit
16 years ago