Ellipses on spheres

1. Jul 12, 2011

Sleeker

I have galaxies in the shapes of ellipses, and I have point sources around these galaxies. I need to find a formula to determine whether or not the point sources are within a specific galaxy or outside. It would be extremely simple with circles, but I can't figure it out with ellipses.

Given:
Major and minor axes of the ellipse in arcminutes.
Angle of major axis relative to north (measured to the east).
Center of galaxy (measured in RA and DEC, easily convertible to azimuth and inclination).
Location of point sources (measured in RA and DEC, easily convertible to azimuth and inclination).

My attempt:
If I set the center of the galaxy and the location of the point source as two vectors (radius = 1, RA = azimuth, 90-DEC = inclination), I can use the dot product to obtain the angle between the galaxy's center and the point source. I just cannot seem to figure out how to check whether or not the point source is within the ellipse or not. It's trivially easy if the distance is less than the minor axis or greater than the major axis, but very difficult if it lies between the two.

The difficult parts are trying to map the ellipse onto the inner surface of the sphere and trying to determine the direction from the galaxy's center to the point source (and then how to use that direction to help me), that is, if I even need to do these things.

My first attempt basically ignored the non-Euclidean nature of the surface and failed at high DECs.

(RA is like longitude and DEC is like latitude.)