gl-matrix icon indicating copy to clipboard operation
gl-matrix copied to clipboard

mat4 rotations

Open z3dev opened this issue 4 years ago • 0 comments

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.

z3dev avatar Jan 13 '21 08:01 z3dev