public static Point3D ReverseLookup( Map map, int xLong, int yLat, int xMins, int yMins, bool xEast, bool ySouth )
{
if ( map == null || map == Map.Internal )
return Point3D.Zero;
int xCenter, yCenter;
int xWidth, yHeight;
if ( !ComputeMapDetails( map, 0, 0, out xCenter, out yCenter, out xWidth, out yHeight ) )
return Point3D.Zero;
double absLong = xLong + ((double)xMins / 60);
double absLat = yLat + ((double)yMins / 60);
if ( !xEast )
absLong = 360.0 - absLong;
if ( !ySouth )
absLat = 360.0 - absLat;
int x, y, z;
x = xCenter + (int)((absLong * xWidth) / 360);
y = yCenter + (int)((absLat * yHeight) / 360);
if ( x < 0 )
x += xWidth;
else if ( x >= xWidth )
x -= xWidth;
if ( y < 0 )
y += yHeight;
else if ( y >= yHeight )
y -= yHeight;
z = map.GetAverageZ( x, y );
return new Point3D( x, y, z );
}