Vladimír Vondruš
4ab3ab6534
Math: added Vector::lengthInverted().
...
Also because there are SIMD instructions for that.
13 years ago
Vladimír Vondruš
6124ad3c27
Math: added sqrtInverted() function.
...
There are SIMD instructions for that, so why not have it in place.
13 years ago
Vladimír Vondruš
7c3cb652bd
Math: doc++
13 years ago
Vladimír Vondruš
bf58bb3cb1
Math: rework of component-wise matrix and vector functions.
...
First, removed functions which can be done with Vector's member
functions and functions from Functions.h. More flexibility and less
redundant code which leads to easier SIMD implementation later.
Vector4 a;
Float b = a.maxAbs(); // before
Float b = Math::abs(a).max(); // now
Second, removed all functions from RectangularMatrix which are
implemented in Vector and added conversion from RectangularMatrix to
Vector and back. Also for more flexibility and less redundant code (i.e.
reusing SIMD-optimized Vector::max() instead of writing it again).
Matrix4x3 a;
Float b = a.max(); // before
Float b = a.toVector().max(); // now
13 years ago
Vladimír Vondruš
a80b4b146d
Math: write Vector2::cross() in terms of perpendicular() and dot().
13 years ago
Vladimír Vondruš
49154f30c4
Math: added Vector2::perpendicular().
...
Also updated and crosslinked related documentation.
13 years ago
Vladimír Vondruš
bba3755da1
GCC 4.8 compilation fixes.
13 years ago
Vladimír Vondruš
b7aeccad4c
Clang compilation fixes.
13 years ago
Vladimír Vondruš
0cd98456da
Math: Added Vector2::cross().
13 years ago
Vladimír Vondruš
b0883f8d6b
Doc++
13 years ago
Vladimír Vondruš
5e8606a755
Math: added sign() function.
13 years ago
Vladimír Vondruš
56139ae365
Math: no need to provide implementation just for Doxygen.
13 years ago
Vladimír Vondruš
8d5b2cae71
Math: std::hypot() is not available in NaCl newlib.
...
Probably bug / not-yet-implemented feature.
13 years ago
Vladimír Vondruš
64585ca4fd
GCC 4.6 compatibility: vector conversion is not constexpr.
13 years ago
Vladimír Vondruš
2d71c86942
Math: make trignometric functions working with Unit base class.
...
The test now passes again.
13 years ago
Vladimír Vondruš
d95c44fcc8
Math: test that trigonometric functions work with Unit base class.
...
The test fails.
13 years ago
Vladimír Vondruš
6802b022ea
Added some TODOs.
13 years ago
Vladimír Vondruš
407071dc96
Math: test also possibility of Unit implicit conversions.
13 years ago
Vladimír Vondruš
32d03530e1
Math: test that implicit conversion vector <-> complex/quat can't compile.
13 years ago
Vladimír Vondruš
37c93468fd
Math: test that implicit conversion of Rectangle type can't compile.
13 years ago
Vladimír Vondruš
51da8bd65b
Math: updated Rectangle test to test constexpr functions.
13 years ago
Vladimír Vondruš
213499e7bb
Math: test that implicit conversion from/to foreign types can't compile.
13 years ago
Vladimír Vondruš
1d5e3fee7a
Math: test that implicit conversion of underlying type can't compile.
13 years ago
Vladimír Vondruš
cc938a29dd
Math: test that implicit conversion of T to Vector<T> won't compile.
...
"Won't compile" tests are another awesome feature of C++11.
13 years ago
Vladimír Vondruš
45ba444fb8
Math: properly test conversion constexpr also in Vector subclasses.
13 years ago
Vladimír Vondruš
83bda8bbe6
Math: fixed test for denormalize<UnsignedLong, long double>().
...
Amazing what single forgotten literal can do.
13 years ago
Vladimír Vondruš
35eb876303
Various other compilation fixes for OpenGL ES target.
13 years ago
Vladimír Vondruš
ba0f56fa51
No need to use Double type in tests so extensively.
...
Makes porting to OpenGL ES easier.
13 years ago
Vladimír Vondruš
b28261d269
Math: fix compilation of tests with OpenGL ES.
...
Double precision is not supported there, mention that for skipped test
cases.
13 years ago
Vladimír Vondruš
be5c872c8a
Math: fixed two typos in the test.
...
They resulted in fact that the test case didn't actually test anything.
Spotted by Clang.
13 years ago
Vladimír Vondruš
fcb756e42a
Revert "GCC 4.6 compatibility: can't list-initialize array of classes."
...
It does too much harm on GCC 4.6 (all these constexpr constructors are
not constexpr now). We can disable that `-pedantic` warning for GCC 4.6
only and live with that.
This reverts commit 2d92d497d9 .
13 years ago
Vladimír Vondruš
dd788285dc
Various code cleanup.
13 years ago
Vladimír Vondruš
2d92d497d9
GCC 4.6 compatibility: can't list-initialize array of classes.
...
Awesome bug. In GCC 4.6 it throws plenty of ungoogleable `-pedantic`
warnings and in GCC 4.5 it fails directly with "error: bad array
initializer". Fallback to initialization using for-cycle.
Hello, performance? You can go home now.
13 years ago
Vladimír Vondruš
999b7d55c0
GCC 4.6 compatibility: no delegating constructors.
...
Don't know why the corresponding conversion operator can't be constexpr.
13 years ago
Vladimír Vondruš
ba105b1cf6
Math: test constexpr vector conversion.
13 years ago
Vladimír Vondruš
7b140db3ed
Properly test swizzle() constexpr.
...
Removed constExpressions() test case and merged it to others, reducing
duplicate code.
13 years ago
Vladimír Vondruš
ce6f999904
Math: better isNormalized() implementation.
...
Comparing squared length to 1 is not sufficient to compare within range
[1 - epsilon, 1 + epsilon], as e.g. Quaternion with dot() = 1 + 1e-7
when converted to matrix has column vectors with dot() = 1 + 1e-6, which
is just above 1 + epsilon. Thus it's needed to compare sqrt(dot()) in
range [1 - epsilon, 1 + epsilon] or dot() in range [1 - 2*epsilon +
epsilon^2, 1 + 2*epsilon + epsilon^2]. Because epsilon^2 is way off
machine precision, it's omitted, thus dot() in all isNormalized()
implementations is now compared this way:
abs(dot() - 1) < 2*epsilon;
13 years ago
Vladimír Vondruš
f4f44d9d90
Math: allow creating DualComplex/DualQuaternion from real part only.
...
Useful when creating transformation from rotation only.
13 years ago
Vladimír Vondruš
4744b631bb
Math: test pow() constexpr.
13 years ago
Vladimír Vondruš
7cb79b145e
Math: test Constants constexpr.
13 years ago
Vladimír Vondruš
b28b90a9df
Math: merged constExpressions() test cases into other test cases.
...
Simplifies the code and reduces duplicates.
13 years ago
Vladimír Vondruš
3e0e91d7db
Math: renamed {rotationAngle, rotationAxis}() -> {rotation, angle, axis}().
...
DualQuaternion and DualComplex has now only rotation() which returns
full rotation part, rotationAngle() and rotationAxis() on Quaternion and
Complex were renamed to angle() and axis().
13 years ago
Vladimír Vondruš
73a4e9b18a
Math: doc++
13 years ago
Vladimír Vondruš
da2bbac104
Math: simplified Matrix::isOrthogonal().
...
No need to call std::abs() when comparing with zero, as dot() should
always be positive.
13 years ago
Vladimír Vondruš
b00554fd7f
Math: added convenience {Quaternion,DualQuaternion}::isNormalized().
13 years ago
Vladimír Vondruš
1790f37295
Math: added convenience functions {Complex,DualComplex}::isNormalized().
13 years ago
Vladimír Vondruš
3db2aa13c4
Math: added convenience function Vector::isNormalized().
13 years ago
Vladimír Vondruš
da93b2ad6a
Math: ability to create Quaternion and DualQuaternion from matrix.
13 years ago
Vladimír Vondruš
9128820e35
Math: ability to create Complex and DualComplex from matrix.
13 years ago
Vladimír Vondruš
33058aa5b0
Math: Matrix::invertedOrthogonal(), Matrix{3,4}::invertedRigid().
...
Renamed original invertedEuclidean() functions to invertedRigid() and
simplified them using isRigidTransformation().
13 years ago