JOML-CI / JOML

A Java math library for OpenGL rendering calculations
MIT License
729 stars 104 forks source link

new AxisAngle4d().set(new Quaterniond()) gives NaN for axes #255

Closed lukehutch closed 4 years ago

lukehutch commented 4 years ago

The following code

var a = new AxisAngle4d();
var q = new Quaterniond();
a.set(q);

gives

a.x == NaN
a.y == NaN
a.z == NaN
a.angle == 0.0

I would expect the axes of a to be zero, not NaN, since the axes of q are zero.

lukehutch commented 4 years ago

Additionally converting a slightly non-normalized unit quaternion (e.g. ( 2.035E-9 4.715E-10 -9.166E-11 1.000E+0)) to AxisAngle4d can result in Inf for each of the axes.

httpdigest commented 4 years ago

Thanks! The case of identity quaternion should be fixed now.

lukehutch commented 4 years ago

Thanks for the quick fixes, as always!