The mat4 implementation kind of punts on invalid rotations, i.e. an axis with a length < EPSILON.
if (len < glMatrix.EPSILON) {
return null;
}
But is returning 'null' the correct thing to do? The calling function now has to trap these strange return values.
In the pure javascript sense, throwing an error makes more sense then returning 'null'.
In the real-world sense, doing something appropriate would make more sense. For rotate(), just return the value of the given matrix. For fromRotation(), just return the identity matrix.
The mat4 implementation kind of punts on invalid rotations, i.e. an axis with a length < EPSILON.
But is returning 'null' the correct thing to do? The calling function now has to trap these strange return values.
In the pure javascript sense, throwing an error makes more sense then returning 'null'.
In the real-world sense, doing something appropriate would make more sense. For rotate(), just return the value of the given matrix. For fromRotation(), just return the identity matrix.