Documentation
¶
Overview ¶
Angle: Chapter 17: Angular Separation.
Functions in this package are useful for Ecliptic, Equatorial, or any similar coordinate frame. To avoid suggestion of a particular frame, function parameters are specified simply as "r1, d1" to correspond to a right ascenscion, declination pair or to a longitude, latitude pair.
In function Sep, Meeus recommends 10 arc min as a threshold. This value is in package base as base.SmallAngle because it has general utility.
Index ¶
- func MinSep(jd1, jd3 float64, r1, d1, r2, d2 []unit.Angle) (unit.Angle, error)
- func MinSepRect(jd1, jd3 float64, r1, d1, r2, d2 []unit.Angle) (unit.Angle, error)
- func RelativePosition(r1, d1, r2, d2 unit.Angle) unit.Angle
- func Sep(r1, d1, r2, d2 unit.Angle) unit.Angle
- func SepHav(r1, d1, r2, d2 unit.Angle) unit.Angle
- func SepPauwels(r1, d1, r2, d2 unit.Angle) unit.Angle
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MinSep ¶
MinSep returns the minimum separation between two moving objects.
The motion is represented as an ephemeris of three rows, equally spaced in time. Jd1, jd3 are julian day times of the first and last rows. R1, d1, r2, d2 are coordinates at the three times. They must each be slices of length 3.
Result is obtained by computing separation at each of the three times and interpolating a minimum. This may be invalid for sufficiently close approaches.
计算两个天体之间的最小角距 此方法是将数据点计算成角距,然后直接对角距3点插值,求取最小值, 当两个天体十分接近时,这个结果是不准确的,要使用方法MinSepRect
func MinSepRect ¶
MinSepRect returns the minimum separation between two moving objects.
Like MinSep, but using a method of rectangular coordinates that gives accurate results even for close approaches. 计算两个天体之间的最小角距 此方法是引入直角坐标 u,v,先将数据点转换成u,v 表达,然后对u,v插值,求取最小值,
func RelativePosition ¶
RelativePosition returns the position angle of one body with respect to another.
The position angle result is measured counter-clockwise from North. 1相对2的角距,从2的正北到1的角度 https://en.wikipedia.org/wiki/Position_angle
func Sep ¶
Sep returns the angular separation between two celestial bodies.
The algorithm is numerically naïve, and while patched up a bit for small separations, remains unstable for separations near π. 计算两天体之间的角距,r为赤经,d为赤纬
Example ¶
// Example 17.a, p. 110.
r1 := unit.NewRA(14, 15, 39.7).Angle()
d1 := unit.NewAngle(' ', 19, 10, 57)
r2 := unit.NewRA(13, 25, 11.6).Angle()
d2 := unit.NewAngle('-', 11, 9, 41)
d := angle.Sep(r1, d1, r2, d2)
fmt.Println(sexa.FmtAngle(d))
Output: 32°47′35″
func SepHav ¶
SepHav returns the angular separation between two celestial bodies.
The algorithm uses the haversine function and is superior to the naïve algorithm of the Sep function. 利用半正矢的特点提高当角距很小时的精确程度
func SepPauwels ¶
SepPauwels returns the angular separation between two celestial bodies.
The algorithm is a numerically stable form of that used in Sep. 当z小于0时,返回值应该在90-180度之间 该方法与直接余弦定理求角距在数学上是等价的, 但是对于计算机来说,arctan 比 arcsin能获得更高的精度
Example ¶
// Example 17.b, p. 116.
r1 := unit.NewRA(14, 15, 39.7).Angle()
d1 := unit.NewAngle(' ', 19, 10, 57)
r2 := unit.NewRA(13, 25, 11.6).Angle()
d2 := unit.NewAngle('-', 11, 9, 41)
d := angle.SepPauwels(r1, d1, r2, d2)
fmt.Println(sexa.FmtAngle(d))
Output: 32°47′35″
Types ¶
This section is empty.