You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
3.5 KiB
Go
148 lines
3.5 KiB
Go
5 years ago
|
package basic
|
||
|
|
||
|
import (
|
||
|
"math"
|
||
|
|
||
|
"b612.me/astro/planet"
|
||
|
. "b612.me/astro/tools"
|
||
|
)
|
||
|
|
||
|
func VenusL(JD float64) float64 {
|
||
|
return planet.WherePlanet(2, 0, JD)
|
||
|
}
|
||
|
|
||
|
func VenusB(JD float64) float64 {
|
||
|
return planet.WherePlanet(2, 1, JD)
|
||
|
}
|
||
|
func VenusR(JD float64) float64 {
|
||
|
return planet.WherePlanet(2, 2, JD)
|
||
|
}
|
||
|
func AVenusX(JD float64) float64 {
|
||
|
l := VenusL(JD)
|
||
|
b := VenusB(JD)
|
||
|
r := VenusR(JD)
|
||
|
el := planet.WherePlanet(-1, 0, JD)
|
||
|
eb := planet.WherePlanet(-1, 1, JD)
|
||
|
er := planet.WherePlanet(-1, 2, JD)
|
||
|
x := r*Cos(b)*Cos(l) - er*Cos(eb)*Cos(el)
|
||
|
return x
|
||
|
}
|
||
|
|
||
|
func AVenusY(JD float64) float64 {
|
||
|
|
||
|
l := VenusL(JD)
|
||
|
b := VenusB(JD)
|
||
|
r := VenusR(JD)
|
||
|
el := planet.WherePlanet(-1, 0, JD)
|
||
|
eb := planet.WherePlanet(-1, 1, JD)
|
||
|
er := planet.WherePlanet(-1, 2, JD)
|
||
|
y := r*Cos(b)*Sin(l) - er*Cos(eb)*Sin(el)
|
||
|
return y
|
||
|
}
|
||
|
func AVenusZ(JD float64) float64 {
|
||
|
//l := VenusL(JD)
|
||
|
b := VenusB(JD)
|
||
|
r := VenusR(JD)
|
||
|
// el := planet.WherePlanet(-1, 0, JD)
|
||
|
eb := planet.WherePlanet(-1, 1, JD)
|
||
|
er := planet.WherePlanet(-1, 2, JD)
|
||
|
z := r*Sin(b) - er*Sin(eb)
|
||
|
return z
|
||
|
}
|
||
|
|
||
|
func AVenusXYZ(JD float64) (float64, float64, float64) {
|
||
|
l := VenusL(JD)
|
||
|
b := VenusB(JD)
|
||
|
r := VenusR(JD)
|
||
|
el := planet.WherePlanet(-1, 0, JD)
|
||
|
eb := planet.WherePlanet(-1, 1, JD)
|
||
|
er := planet.WherePlanet(-1, 2, JD)
|
||
|
x := r*Cos(b)*Cos(l) - er*Cos(eb)*Cos(el)
|
||
|
y := r*Cos(b)*Sin(l) - er*Cos(eb)*Sin(el)
|
||
|
z := r*Sin(b) - er*Sin(eb)
|
||
|
return x, y, z
|
||
|
}
|
||
|
|
||
|
func VenusSeeRa(JD float64) float64 {
|
||
|
lo, bo := VenusSeeLoBo(JD)
|
||
|
sita := Sita(JD)
|
||
|
ra := math.Atan2((Sin(lo)*Cos(sita) - Tan(bo)*Sin(sita)), Cos(lo))
|
||
|
ra = ra * 180 / math.Pi
|
||
|
return Limit360(ra)
|
||
|
}
|
||
|
func VenusSeeDec(JD float64) float64 {
|
||
|
lo, bo := VenusSeeLoBo(JD)
|
||
|
sita := Sita(JD)
|
||
|
dec := ArcSin(Sin(bo)*Cos(sita) + Cos(bo)*Sin(sita)*Sin(lo))
|
||
|
return dec
|
||
|
}
|
||
|
|
||
|
func VenusSeeRaDec(JD float64) (float64, float64) {
|
||
|
lo, bo := VenusSeeLoBo(JD)
|
||
|
sita := Sita(JD)
|
||
|
ra := math.Atan2((Sin(lo)*Cos(sita) - Tan(bo)*Sin(sita)), Cos(lo))
|
||
|
ra = ra * 180 / math.Pi
|
||
|
dec := ArcSin(Sin(bo)*Cos(sita) + Cos(bo)*Sin(sita)*Sin(lo))
|
||
|
return Limit360(ra), dec
|
||
|
}
|
||
|
|
||
|
func EarthVenusAway(JD float64) float64 {
|
||
|
x, y, z := AVenusXYZ(JD)
|
||
|
to := math.Sqrt(x*x + y*y + z*z)
|
||
|
return to
|
||
|
}
|
||
|
|
||
|
func VenusSeeLo(JD float64) float64 {
|
||
|
x, y, z := AVenusXYZ(JD)
|
||
|
to := 0.0057755183 * math.Sqrt(x*x+y*y+z*z)
|
||
|
x, y, z = AVenusXYZ(JD - to)
|
||
|
lo := math.Atan2(y, x)
|
||
|
bo := math.Atan2(z, math.Sqrt(x*x+y*y))
|
||
|
lo = lo * 180 / math.Pi
|
||
|
bo = bo * 180 / math.Pi
|
||
|
lo = Limit360(lo)
|
||
|
//lo-=GXCLo(lo,bo,JD)/3600;
|
||
|
//bo+=GXCBo(lo,bo,JD);
|
||
|
lo += HJZD(JD)
|
||
|
return lo
|
||
|
}
|
||
|
|
||
|
func VenusSeeBo(JD float64) float64 {
|
||
|
x, y, z := AVenusXYZ(JD)
|
||
|
to := 0.0057755183 * math.Sqrt(x*x+y*y+z*z)
|
||
|
x, y, z = AVenusXYZ(JD - to)
|
||
|
//lo := math.Atan2(y, x)
|
||
|
bo := math.Atan2(z, math.Sqrt(x*x+y*y))
|
||
|
//lo = lo * 180 / math.Pi
|
||
|
bo = bo * 180 / math.Pi
|
||
|
//lo+=GXCLo(lo,bo,JD);
|
||
|
//bo+=GXCBo(lo,bo,JD)/3600;
|
||
|
//lo+=HJZD(JD);
|
||
|
return bo
|
||
|
}
|
||
|
|
||
|
func VenusSeeLoBo(JD float64) (float64, float64) {
|
||
|
x, y, z := AVenusXYZ(JD)
|
||
|
to := 0.0057755183 * math.Sqrt(x*x+y*y+z*z)
|
||
|
x, y, z = AVenusXYZ(JD - to)
|
||
|
lo := math.Atan2(y, x)
|
||
|
bo := math.Atan2(z, math.Sqrt(x*x+y*y))
|
||
|
lo = lo * 180 / math.Pi
|
||
|
bo = bo * 180 / math.Pi
|
||
|
lo = Limit360(lo)
|
||
|
//lo-=GXCLo(lo,bo,JD)/3600;
|
||
|
//bo+=GXCBo(lo,bo,JD);
|
||
|
lo += HJZD(JD)
|
||
|
return lo, bo
|
||
|
}
|
||
|
|
||
|
func VenusMag(JD float64) float64 {
|
||
|
AwaySun := VenusR(JD)
|
||
|
AwayEarth := EarthVenusAway(JD)
|
||
|
Away := planet.WherePlanet(-1, 2, JD)
|
||
|
i := (AwaySun*AwaySun + AwayEarth*AwayEarth - Away*Away) / (2 * AwaySun * AwayEarth)
|
||
|
i = ArcCos(i)
|
||
|
Mag := -4.40 + 5*math.Log10(AwaySun*AwayEarth) + 0.0009*i + 0.000239*i*i - 0.00000065*i*i*i
|
||
|
return FloatRound(Mag, 2)
|
||
|
}
|