This is not a problematic issue, because Chandra never operates close to declination 90 or -90. Still, this is wrong and kind of bugs me. Let's see if we can fix it.
Tom added that the issue is worse, because the numerical precision worsens as declination approaches 90 or -90. What would be the point of fixing this issue if we still have floating point precision issues? It remains to be seen whether we can fix this.
A possible solution to the first issue
This is my current understanding of the issue. The rotation matrix in equatorial coordinates is given by:
The following test (which explores an occurrence of gimbal lock) currently fails:
This is not a problematic issue, because Chandra never operates close to declination 90 or -90. Still, this is wrong and kind of bugs me. Let's see if we can fix it.
Tom added that the issue is worse, because the numerical precision worsens as declination approaches 90 or -90. What would be the point of fixing this issue if we still have floating point precision issues? It remains to be seen whether we can fix this.
A possible solution to the first issue
This is my current understanding of the issue. The rotation matrix in equatorial coordinates is given by:
where (alpha, delta, rho) is (RA, dec, roll).
alpha and rho are currently determined by doing:
and this fails when m[0,1] = m[0,0] = m[0,1] = m[0,0] = 0). One could do instead (by convention, choose rho=0 to break the degeneracy):