make_rect_poly returns nans if half-diagonal angle is >90°
make_rect_poly returns nans if the angle from the center of the polygon to the vertices is >90°. This is because the edges of the rectangle are currently defined as small circles (spheric sections) formed by the intersection of a 3D rectangular prism with the sphere, and for sufficiently large polygons, the edges do not intersect at all on the surface of the sphere.
The edges should instead be defined as great circles, which will allow for the edges to intersect even for large angles. Great circles are probably also more consistent with a user's expectation that the figure drawn by make_rect_poly is the same as the footprint of a gnomonic WCS projection (CTYPE1="RA---TAN"
, CTYPE2="DEC--TAN"
), because in a gnomonic projection, all straight lines (including the edges of the projection) are great circles. (The gnomonic projection is the most common projection used in optical astronomy.)