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.
Excessive parentheses only make the expressions hareder to read.
Replace use of float by double.
All values in a quaternion are declared double, let's not lose precision onplatforms where double is larger than float.
Simplify a few more functions, and pass vector arguments by reference
Simplify constructors
Simplify several functions by replacing the body with one-line calls to theconstructor. Furthermore, pass Quaternion arguments by reference to avoidexcessive copying.
Quaternion needs the definition of a matrix. Include it.
Fix conversion of impure rotation matrices to quaternions
The test for the largest element in the matrix diagonal was reversed, whichresulted in taking the square root of a negative value for matrices withdeterminant less than zero.
Store determinant as double when computing matrix inverse. Does not matter on Arduino, but might on other platforms.
The recursive definition of the determinant function, combined with the factthat no specialized function for the base case N==1 is given, leads toinstantiation of this function for all 256 possible values of a uint8_t (eventhough these are not used in practice). Fix this by providing an explicit...
Remove inclusion of unused headers
Fix calculation of inverse. We should divide by the determinant instead of multiply with it.
Fix minor_matrix() accessing data past end of array.
Get rid of superfluous _cell member
Use more standard (i, j) index names and constify transpose()
Prevent copying row data for every element in matrix multiplication.
Dox matrix addition, subtraction, and scalar multiplication using a single loop instead of a double loop.
make row and column retrieval function const, pass Vector arguments to row and column setters as const reference
Use a single loop to copy matrices
Add functions for reading elements of constant matrix
Fix memset() in constructors writing past end of data
Include vector.h, so that including just matrix.h will pull in the requested dependencies
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