本文整理汇总了Golang中github.com/soniakeys/meeus/base.NewAngle函数的典型用法代码示例。如果您正苦于以下问题:Golang NewAngle函数的具体用法?Golang NewAngle怎么用?Golang NewAngle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewAngle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestPrecessor_Precess
func TestPrecessor_Precess(t *testing.T) {
// Exercise, p. 136.
eqFrom := &coord.Equatorial{
RA: base.NewRA(2, 31, 48.704).Rad(),
Dec: base.NewAngle(false, 89, 15, 50.72).Rad(),
}
mα := base.NewHourAngle(false, 0, 0, .19877)
mδ := base.NewAngle(false, 0, 0, -.0152)
epochs := []float64{
base.JDEToJulianYear(base.B1900),
2050,
2100,
}
answer := []string{
"α = 1ʰ22ᵐ33ˢ.90 δ = +88°46′26″.18",
"α = 3ʰ48ᵐ16ˢ.43 δ = +89°27′15″.38",
"α = 5ʰ53ᵐ29ˢ.17 δ = +89°32′22″.18",
}
eqTo := &coord.Equatorial{}
for i, epochTo := range epochs {
precess.Position(eqFrom, eqTo, 2000, epochTo, mα, mδ)
if answer[i] != fmt.Sprintf("α = %0.2d δ = %+0.2d",
base.NewFmtRA(eqTo.RA), base.NewFmtAngle(eqTo.Dec)) {
t.Fatal(i)
}
}
}
开发者ID:pjh59,项目名称:meeus,代码行数:27,代码来源:precess_test.go
示例2: ExampleProperMotion3D
func ExampleProperMotion3D() {
// Example 21.d, p. 141.
eqFrom := &coord.Equatorial{
RA: base.NewRA(6, 45, 8.871).Rad(),
Dec: base.NewAngle(true, 16, 42, 57.99).Rad(),
}
mra := base.NewHourAngle(false, 0, 0, -0.03847)
mdec := base.NewAngle(false, 0, 0, -1.2053)
r := 2.64 // given in correct unit
mr := -7.6 / 977792 // magic conversion factor
eqTo := &coord.Equatorial{}
fmt.Printf("Δr = %.9f, Δα = %.10f, Δδ = %.10f\n", mr, mra, mdec)
for _, epoch := range []float64{1000, 0, -1000, -2000, -10000} {
precess.ProperMotion3D(eqFrom, eqTo, 2000, epoch, r, mr, mra, mdec)
fmt.Printf("%8.1f %0.2d %-0.1d\n", epoch,
base.NewFmtRA(eqTo.RA), base.NewFmtAngle(eqTo.Dec))
}
// Output:
// Δr = -0.000007773, Δα = -0.0000027976, Δδ = -0.0000058435
// 1000.0 6ʰ45ᵐ47ˢ.16 -16°22′56″.0
// 0.0 6ʰ46ᵐ25ˢ.09 -16°03′00″.8
// -1000.0 6ʰ47ᵐ02ˢ.67 -15°43′12″.3
// -2000.0 6ʰ47ᵐ39ˢ.91 -15°23′30″.6
// -10000.0 6ʰ52ᵐ25ˢ.72 -12°50′06″.7
}
开发者ID:pjh59,项目名称:meeus,代码行数:25,代码来源:precess_test.go
示例3: TestPosition
// Exercise, p. 136.
func TestPosition(t *testing.T) {
eqFrom := &coord.Equatorial{
base.NewRA(2, 31, 48.704).Rad(),
base.NewAngle(false, 89, 15, 50.72).Rad(),
}
eqTo := &coord.Equatorial{}
mα := base.NewHourAngle(false, 0, 0, 0.19877)
mδ := base.NewAngle(true, 0, 0, 0.0152)
for _, tc := range []struct {
α, δ string
jde float64
}{
{"1 22 33.90", "88 46 26.18", base.BesselianYearToJDE(1900)},
{"3 48 16.43", "89 27 15.38", base.JulianYearToJDE(2050)},
{"5 53 29.17", "89 32 22.18", base.JulianYearToJDE(2100)},
} {
epochTo := base.JDEToJulianYear(tc.jde)
precess.Position(eqFrom, eqTo, 2000.0, epochTo, mα, mδ)
αStr := fmt.Sprintf("%.2x", base.NewFmtRA(eqTo.RA))
δStr := fmt.Sprintf("%.2x", base.NewFmtAngle(eqTo.Dec))
if αStr != tc.α {
t.Fatal("got:", αStr, "want:", tc.α)
}
if δStr != tc.δ {
t.Fatal(δStr)
}
}
}
开发者ID:pjh59,项目名称:meeus,代码行数:29,代码来源:precess_test.go
示例4: ExampleApproxTimes
func ExampleApproxTimes() {
// Example 15.a, p. 103.
jd := julian.CalendarGregorianToJD(1988, 3, 20)
p := globe.Coord{
Lon: base.NewAngle(false, 71, 5, 0).Rad(),
Lat: base.NewAngle(false, 42, 20, 0).Rad(),
}
// Meeus gives us the value of 11h 50m 58.1s but we have a package
// function for this:
Th0 := sidereal.Apparent0UT(jd)
α := base.NewRA(2, 46, 55.51).Rad()
δ := base.NewAngle(false, 18, 26, 27.3).Rad()
h0 := rise.Stdh0Stellar
rise, transit, set, err := rise.ApproxTimes(p, h0, Th0, α, δ)
if err != nil {
fmt.Println(err)
return
}
// Units for approximate values given near top of p. 104 are circles.
fmt.Printf("rising: %+.5f\n", rise/86400)
fmt.Printf("transit: %+.5f\n", transit/86400)
fmt.Printf("seting: %+.5f\n", set/86400)
// Output:
// rising: +0.51816
// transit: +0.81965
// seting: +0.12113
}
开发者ID:pjh59,项目名称:meeus,代码行数:27,代码来源:rise_test.go
示例5: ExampleNewAngle
func ExampleNewAngle() {
// Example negative values, p. 9.
a := base.NewAngle(true, 13, 47, 22)
fmt.Println(base.NewFmtAngle(a.Rad()))
a = base.NewAngle(true, 0, 32, 41)
// use # flag to force output of all three components
fmt.Printf("%#s\n", base.NewFmtAngle(a.Rad()))
// Output:
// -13°47′22″
// -0°32′41″
}
开发者ID:pjh59,项目名称:meeus,代码行数:11,代码来源:sexagesimal_test.go
示例6: TestSep
// First exercise, p. 110.
func TestSep(t *testing.T) {
r1 := base.NewRA(4, 35, 55.2).Rad()
d1 := base.NewAngle(false, 16, 30, 33).Rad()
r2 := base.NewRA(16, 29, 24).Rad()
d2 := base.NewAngle(true, 26, 25, 55).Rad()
d := angle.Sep(r1, d1, r2, d2)
answer := base.NewAngle(false, 169, 58, 0).Rad()
if math.Abs(d-answer) > 1e-4 {
t.Fatal(base.NewFmtAngle(d))
}
}
开发者ID:pjh59,项目名称:meeus,代码行数:12,代码来源:angle_test.go
示例7: ExampleSep
func ExampleSep() {
// Example 17.a, p. 110.
r1 := base.NewRA(14, 15, 39.7).Rad()
d1 := base.NewAngle(false, 19, 10, 57).Rad()
r2 := base.NewRA(13, 25, 11.6).Rad()
d2 := base.NewAngle(true, 11, 9, 41).Rad()
d := angle.Sep(r1, d1, r2, d2)
fmt.Println(base.NewFmtAngle(d))
// Output:
// 32°47′35″
}
开发者ID:pjh59,项目名称:meeus,代码行数:11,代码来源:angle_test.go
示例8: TestSepHav
func TestSepHav(t *testing.T) {
// Example 17.a, p. 110.
r1 := base.NewRA(14, 15, 39.7).Rad()
d1 := base.NewAngle(false, 19, 10, 57).Rad()
r2 := base.NewRA(13, 25, 11.6).Rad()
d2 := base.NewAngle(true, 11, 9, 41).Rad()
d := angle.SepHav(r1, d1, r2, d2)
s := fmt.Sprint(base.NewFmtAngle(d))
if s != "32°47′35″" {
t.Fatal(s)
}
}
开发者ID:pjh59,项目名称:meeus,代码行数:12,代码来源:angle_test.go
示例9: ExampleAngleError
func ExampleAngleError() {
// Example p. 125.
rδ := base.NewRA(5, 32, 0.40).Rad()
dδ := base.NewAngle(true, 0, 17, 56.9).Rad()
rε := base.NewRA(5, 36, 12.81).Rad()
dε := base.NewAngle(true, 1, 12, 7.0).Rad()
rζ := base.NewRA(5, 40, 45.52).Rad()
dζ := base.NewAngle(true, 1, 56, 33.3).Rad()
n, ω := line.AngleError(rδ, dδ, rε, dε, rζ, dζ)
fmt.Printf("%.62s\n", base.NewFmtAngle(n))
fmt.Println(base.NewFmtAngle(ω))
// Output:
// 7°31′
// -5′24″
}
开发者ID:pjh59,项目名称:meeus,代码行数:16,代码来源:line_test.go
示例10: TestLatDiff
// p. 83
func TestLatDiff(t *testing.T) {
φ0 := base.NewAngle(false, 45, 5, 46.36).Rad()
diff := base.NewFmtAngle(globe.GeocentricLatitudeDifference(φ0))
if f := fmt.Sprintf("%.2d", diff); f != "11′32″.73" {
t.Fatal(f)
}
}
开发者ID:pjh59,项目名称:meeus,代码行数:8,代码来源:globe_test.go
示例11: ExamplePositionRonVondrak
func ExamplePositionRonVondrak() {
// Example 23.b, p. 156
jd := julian.CalendarGregorianToJD(2028, 11, 13.19)
eq := &coord.Equatorial{
RA: base.NewRA(2, 44, 11.986).Rad(),
Dec: base.NewAngle(false, 49, 13, 42.48).Rad(),
}
apparent.PositionRonVondrak(eq, eq, base.JDEToJulianYear(jd),
base.NewHourAngle(false, 0, 0, 0.03425),
base.NewAngle(true, 0, 0, 0.0895))
fmt.Printf("α = %0.3d\n", base.NewFmtRA(eq.RA))
fmt.Printf("δ = %0.2d\n", base.NewFmtAngle(eq.Dec))
// Output:
// α = 2ʰ46ᵐ14ˢ.392
// δ = 49°21′07″.45
}
开发者ID:pjh59,项目名称:meeus,代码行数:16,代码来源:apparent_test.go
示例12: ExampleAngle
func ExampleAngle() {
// Example p. 123.
rδ := base.NewRA(5, 32, 0.40).Rad()
dδ := base.NewAngle(true, 0, 17, 56.9).Rad()
rε := base.NewRA(5, 36, 12.81).Rad()
dε := base.NewAngle(true, 1, 12, 7.0).Rad()
rζ := base.NewRA(5, 40, 45.52).Rad()
dζ := base.NewAngle(true, 1, 56, 33.3).Rad()
n := line.Angle(rδ, dδ, rε, dε, rζ, dζ)
fmt.Printf("%.4f degrees\n", n*180/math.Pi)
fmt.Printf("%.62s\n", base.NewFmtAngle(n))
// Output:
// 172.4830 degrees
// 172°29′
}
开发者ID:pjh59,项目名称:meeus,代码行数:16,代码来源:line_test.go
示例13: ExampleApproxPosition
func ExampleApproxPosition() {
// Example 21.a, p. 132.
eq := &coord.Equatorial{
base.NewRA(10, 8, 22.3).Rad(),
base.NewAngle(false, 11, 58, 2).Rad(),
}
epochFrom := 2000.0
epochTo := 1978.0
mα := base.NewHourAngle(true, 0, 0, 0.0169)
mδ := base.NewAngle(false, 0, 0, 0.006)
precess.ApproxPosition(eq, eq, epochFrom, epochTo, mα, mδ)
fmt.Printf("%0.1d\n", base.NewFmtRA(eq.RA))
fmt.Printf("%+0d\n", base.NewFmtAngle(eq.Dec))
// Output:
// 10ʰ07ᵐ12ˢ.1
// +12°04′32″
}
开发者ID:pjh59,项目名称:meeus,代码行数:17,代码来源:precess_test.go
示例14: ApproxAnnualPrecession
// ApproxAnnualPrecession returns approximate annual precision in right
// ascension and declination.
//
// The two epochs should be within a few hundred years.
// The declinations should not be too close to the poles.
func ApproxAnnualPrecession(eq *coord.Equatorial, epochFrom, epochTo float64) (Δα base.HourAngle, Δδ base.Angle) {
m, na, nd := mn(epochFrom, epochTo)
sa, ca := math.Sincos(eq.RA)
// (21.1) p. 132
Δαs := m + na*sa*math.Tan(eq.Dec) // seconds of RA
Δδs := nd * ca // seconds of Dec
return base.NewHourAngle(false, 0, 0, Δαs), base.NewAngle(false, 0, 0, Δδs)
}
开发者ID:pjh59,项目名称:meeus,代码行数:13,代码来源:precess.go
示例15: MeanObliquity
// MeanObliquity returns mean obliquity (ε₀) following the IAU 1980
// polynomial.
//
// Accuracy is 1″ over the range 1000 to 3000 years and 10″ over the range
// 0 to 4000 years.
//
// Result unit is radians.
func MeanObliquity(jde float64) float64 {
// (22.2) p. 147
return base.Horner(base.J2000Century(jde),
base.NewAngle(false, 23, 26, 21.448).Rad(),
-46.815/3600*(math.Pi/180),
-0.00059/3600*(math.Pi/180),
0.001813/3600*(math.Pi/180))
}
开发者ID:pjh59,项目名称:meeus,代码行数:15,代码来源:nutation.go
示例16: ExamplePosition
func ExamplePosition() {
// Example 21.b, p. 135.
eq := &coord.Equatorial{
base.NewRA(2, 44, 11.986).Rad(),
base.NewAngle(false, 49, 13, 42.48).Rad(),
}
epochFrom := 2000.0
jdTo := julian.CalendarGregorianToJD(2028, 11, 13.19)
epochTo := base.JDEToJulianYear(jdTo)
precess.Position(eq, eq, epochFrom, epochTo,
base.NewHourAngle(false, 0, 0, 0.03425),
base.NewAngle(true, 0, 0, 0.0895))
fmt.Printf("%0.3d\n", base.NewFmtRA(eq.RA))
fmt.Printf("%+0.2d\n", base.NewFmtAngle(eq.Dec))
// Output:
// 2ʰ46ᵐ11ˢ.331
// +49°20′54″.54
}
开发者ID:pjh59,项目名称:meeus,代码行数:18,代码来源:precess_test.go
示例17: ExampleError
func ExampleError() {
// Example p. 124.
rδ := base.NewRA(5, 32, 0.40).Rad()
dδ := base.NewAngle(true, 0, 17, 56.9).Rad()
rε := base.NewRA(5, 36, 12.81).Rad()
dε := base.NewAngle(true, 1, 12, 7.0).Rad()
rζ := base.NewRA(5, 40, 45.52).Rad()
dζ := base.NewAngle(true, 1, 56, 33.3).Rad()
ω := line.Error(rζ, dζ, rδ, dδ, rε, dε)
fmt.Println(base.DecSymAdd(fmt.Sprintf("%.6f", ω*180/math.Pi), '°'))
fmt.Printf("%.0f″\n", ω*3600*180/math.Pi)
fmt.Println(base.NewFmtAngle(ω))
// Output:
// 0°.089876
// 324″
// 5′24″
}
开发者ID:pjh59,项目名称:meeus,代码行数:18,代码来源:line_test.go
示例18: ExampleSmallest_b
func ExampleSmallest_b() {
// Exercise, p. 128.
r1 := base.NewRA(9, 5, 41.44).Rad()
r2 := base.NewRA(9, 9, 29).Rad()
r3 := base.NewRA(8, 59, 47.14).Rad()
d1 := base.NewAngle(false, 18, 30, 30).Rad()
d2 := base.NewAngle(false, 17, 43, 56.7).Rad()
d3 := base.NewAngle(false, 17, 49, 36.8).Rad()
d, t := circle.Smallest(r1, d1, r2, d2, r3, d3)
fmt.Printf("Δ = %.62s\n", base.NewFmtAngle(d))
if t {
fmt.Println("type I")
} else {
fmt.Println("type II")
}
// Output:
// Δ = 2°19′
// type I
}
开发者ID:pjh59,项目名称:meeus,代码行数:19,代码来源:circle_test.go
示例19: ExampleNutation
func ExampleNutation() {
// Example 23.a, p. 152
α := base.NewRA(2, 46, 11.331).Rad()
δ := base.NewAngle(false, 49, 20, 54.54).Rad()
jd := julian.CalendarGregorianToJD(2028, 11, 13.19)
Δα1, Δδ1 := apparent.Nutation(α, δ, jd)
fmt.Printf("%.3s %.3s\n", base.NewFmtAngle(Δα1), base.NewFmtAngle(Δδ1))
// Output:
// 15.843″ 6.217″
}
开发者ID:pjh59,项目名称:meeus,代码行数:10,代码来源:apparent_test.go
示例20: ExampleAberration
func ExampleAberration() {
// Example 23.a, p. 152
α := base.NewRA(2, 46, 11.331).Rad()
δ := base.NewAngle(false, 49, 20, 54.54).Rad()
jd := julian.CalendarGregorianToJD(2028, 11, 13.19)
Δα2, Δδ2 := apparent.Aberration(α, δ, jd)
fmt.Printf("%.3s %.3s\n", base.NewFmtAngle(Δα2), base.NewFmtAngle(Δδ2))
// Output:
// 30.045″ 6.697″
}
开发者ID:pjh59,项目名称:meeus,代码行数:10,代码来源:apparent_test.go
注:本文中的github.com/soniakeys/meeus/base.NewAngle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论