There are more cases that should be fixed, but this is the most
problematic one, as this might look completely innocent:
Vector2 a, b;
float* c = (a + b).data();
Unlike this, which looks suspicious:
Vector2& c = a + b;
Unlike Matrix3/Matrix4 these don't have any transformation-related
functions. Deprecated the old Matrix2 typedef, which is now replaced
with Matrix2x2 and will be removed in future release.
They were already in Magnum namespace for floats and doubles, now they
can be used also for generic type (e.g. use `Math::Matrix2x3<T>` instead
of overly verbose `Math::RectangularMatrix<2, 3, T>`). GCC 4.7+ only.
All the functionality is moved to Math::swizzle() and the result is
casted to given type only if its header is included. Thus it is possible
to remove include dependency on Color. The original swizzle() is now
just an alias marked as deprecated and will be removed in future
release.
Consider this craziness when setting up projection or something similar:
Vector2i framebufferSize;
Float aspectRatio = Float(framebufferSize.x())/framebufferSize.y();
And now, behold, the convenience:
Float aspectRatio = Vector2(framebufferSize).aspectRatio();
We would need to duplicate all the functionality found in Vector, which
I don't think is needed at all. If anyone needs to do this, it is
possible to "linearize" the matrix into long vector and do the
operations on it.
Also updated subclass operator implementation, added tests for it, both
for proper returned value and proper result type.
Operators that are part of Vector are operating only with the same type
as Vector itself, operators for multiplying/dividing integral vectors
with floating-point numbers and vectors are now out-of-class and enabled
only for integer vectors. It allows better control (e.g. multiplying
integer and floating-point vector will _always_ result in floating-point
one). Thoroughly tested integer/FP operations and also reworked and
tested operator and funciton reimplementations in subclasses, both for
value correctness and result type correctness.
Needed to adjust the test cases slightly, because they were firing the
assert even if they shouldn't and the "expect fail" case wasn't working
at all. I now badly need proper floating-point equality comparison.
It seems that with Clang you cannot split declaration and definition of
`constexpr` function. These should be as short as possible anyway, thus
it is non-issue.
Also fixed unary RectangularMatrix::operator-() and Vector::operator-()
documentation (was stating that the operation is done in-place, which is
impossible.
Moved all instantiation into instantiation.cpp and removed the rest
(~200 lines of mainly license headers). Saves another ~3 seconds (4:06
before, 4:03 now). I'm done with these micro-optimizations for now.