Next Previous Up Contents
Next: Strings
Up: Functions
Previous: Shapes

#### 10.6.17 Sky

Functions useful for working with shapes on a sphere. All angles are expressed in degrees.

`skyDistance( lon1, lat1, lon2, lat2 )`
Calculates the separation (distance around a great circle) of two points on the sky in degrees.

This function is identical to `skyDistanceDegrees` in class `CoordsDegrees`.

• Parameters:
• `lon1` (floating point): point 1 longitude in degrees
• `lat1` (floating point): point 1 latitude in degrees
• `lon2` (floating point): point 2 longitude in degrees
• `lat2` (floating point): point 2 latitude in degrees
• Return value
• (floating point): angular distance between point 1 and point 2 in degrees

`midLon( lon1, lon2 )`
Determines the longitude mid-way between two given longitudes. In most cases this is just the mean of the two values, but this function copes correctly with the case where the given values straddle the lon=0 line.

• Parameters:
• `lon1` (floating point): first longitude in degrees
• `lon2` (floating point): second longitude in degrees
• Return value
• (floating point): longitude midway between the given values
• Examples:
• `midLon(204.0, 203.5) = 203.75`
• `midLon(2, 359) = 0.5`

`midLat( lat1, lat2 )`
Determines the latitude midway between two given latitudes. This simply returns the mean of the two values, but is supplied for convenience to use alongside the `midLon` function.

• Parameters:
• `lat1` (floating point): first latitude in degrees
• `lat2` (floating point): second latitude in degrees
• Return value
• (floating point): latitude midway between the given values
• Example:
• `midLat(23.5, 24.0) = 23.75`

`inSkyPolygon( lon0, lat0, 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` (floating point): test point latitude in degrees
• `lat0` (floating point): test point longitude in degrees
• `lonLats` (floating point, one or more): 2N arguments (`lon1`, `lat1`, `lon2`, `lat2`, ..., `lonN`, `latN`) giving (longitude, latitude) vertices of an N-sided polygon in degrees
• Return value
• (boolean): true iff test point is inside, or on the border of, the polygon

Next Previous Up Contents
Next: Strings
Up: Functions
Previous: Shapes

STILTS - Starlink Tables Infrastructure Library Tool Set
{"ft_lang_label":"__label__en","ft_lang_prob":0.62535846,"math_prob":0.9728753,"size":3024,"snap":"2022-05-2022-21","text_gpt3_token_len":762,"char_repetition_ratio":0.17781457,"word_repetition_ratio":0.10309278,"special_character_ratio":0.24735449,"punctuation_ratio":0.16637169,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99379647,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-23T15:33:19Z\",\"WARC-Record-ID\":\"<urn:uuid:ee1c25c1-10cd-42f1-9a67-89c5defd518b>\",\"Content-Length\":\"5812\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b8a9f8f5-c5af-4f81-95e6-4c63f9630d13>\",\"WARC-Concurrent-To\":\"<urn:uuid:d58a49a0-eb5f-4949-8ece-40e780b35860>\",\"WARC-IP-Address\":\"137.222.4.120\",\"WARC-Target-URI\":\"http://www.star.bristol.ac.uk/~mbt/stilts/sun256/uk.ac.starlink.ttools.func.Sky.html\",\"WARC-Payload-Digest\":\"sha1:ZQ4F3QREEHUI2P4ZRPYZ567MSQPZ5LAZ\",\"WARC-Block-Digest\":\"sha1:C4ZL3BHLH4JIETWGUXRY65YHDQB6D7VE\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662558030.43_warc_CC-MAIN-20220523132100-20220523162100-00503.warc.gz\"}"}