Package uk.ac.starlink.ttools.func
Class Sky
- java.lang.Object
-
- uk.ac.starlink.ttools.func.Sky
-
public class Sky extends java.lang.Object
Functions useful for working with shapes on a sphere. All angles are expressed in degrees.- Since:
- 13 Feb 2019
- Author:
- Mark Taylor
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
inSkyPolygon(double lon0, double lat0, double... lonLats)
Tests whether a given sky position is inside the polygon defined by a given set of vertices.static double
skyDistance(double lon1, double lat1, double lon2, double lat2)
Calculates the separation (distance around a great circle) of two points on the sky in degrees.
-
-
-
Method Detail
-
skyDistance
public static double skyDistance(double lon1, double lat1, double lon2, double lat2)
Calculates the separation (distance around a great circle) of two points on the sky in degrees.This function is identical to
skyDistanceDegrees
in classCoordsDegrees
.- Parameters:
lon1
- point 1 longitude in degreeslat1
- point 1 latitude in degreeslon2
- point 2 longitude in degreeslat2
- point 2 latitude in degrees- Returns:
- angular distance between point 1 and point 2 in degrees
-
inSkyPolygon
public static boolean inSkyPolygon(double lon0, double lat0, double... lonLats)
Tests whether a given sky position is inside the polygon defined by a given set of vertices. The bounding lines of the polygon are the minor arcs of great circles between adjacent vertices, with an extra line assumed between the first and last supplied vertex. The interior of the polygon is defined to be the smaller of the two regions separated by the boundary. The vertices are specified as a sequence of loni, lati pairs.The implementation of this point-in-polygon function is mostly correct, but may not be bulletproof. It ought to work for relatively small regions anywhere on the sky, but for instance it may get the sense wrong for regions that extend to cover both poles.
- Parameters:
lon0
- test point latitude in degreeslat0
- test point longitude in degreeslonLats
- 2N arguments (lon1
,lat1
,lon2
,lat2
, ...,lonN
,latN
) giving (longitude, latitude) vertices of an N-sided polygon in degrees- Returns:
- true iff test point is inside, or on the border of, the polygon
-
-