History | View | Annotate | Download (4.911 KB)
Fix use of abs() function with float argument.
The abs() function in stdlib.h takes an integer argument. Passing it a floatwill silently convert the argument to int, and take the absolute value of theresult. Hence, abs(0.99) == 0, which is not what was intended. Use fabs instead.
make member functions const where appropriate, and pass vectors by reference
Remove unused include
The cross product is only defined for 3D vectors. Instead of checking the sizeat runtime, only provide an implementation for N==3. Trying to use the crossfunction with other vector sizes will then result in a link error.
Remove unnecessary double* pointer from Vector<N>
The pointer prevents the use of bitwise move/copy/initialize operationson Vector(). Less importantly, it's an unnecessary memory bloat.
Bug fix for Vector::magnitude()
Sample failure: Vector<1>(0.5).magnitude() returns 1, not 0.5.The avoid-sqrt optimization is dubious at best, and should arguablyjust be removed.
Add "const" to non-mutating Vector, Quat methods
Also adds some clarifying documentation, since the quat->euler axisconventions are a bit surprising.
Switch from dynamic memory to stack allocated memory for imumath types, add TinyWireM support, make indentation consistent.
First commit