Tip: if you need Sin(A) and Cos(A), it can be faster to make a single
call to SinCos instead of two separated calls to Sin and Cos:
https://www.freepascal.org/docs-html/rtl/math/sincos.html
It was efficient 20 years ago when I was developing a sky map software,
may be the gain is negligible
James, are you not applying the rotation universally to all coordinates? If so,
you are better off pre-calculating your directional sines and cosines.
For example:
TH: REAL; {ROTATIONS (in degrees) AROUND Z-AXIS BY theta, LEFTRIGHT-> turn
its back to us}
PHI: REAL; {ROTATIONS (in degrees)