coordinate frames transformation

This commit is contained in:
nuknal
2024-08-15 14:01:05 +08:00
parent 7c1240f2db
commit c2480a828b
12 changed files with 19640 additions and 16 deletions

View File

@@ -15,7 +15,7 @@ type IntersectionPoint struct {
H float64
}
func IntersectionAttitude(q Quaternion, satPos84 []float64, satTime time.Time, ucam int) (IntersectionPoint, error) {
func IntersectionAttitude(q Quaternion, satPosECI, satPos84 []float64, satTime time.Time, ucam int) (IntersectionPoint, error) {
// alpha := FOV * math.Pi / 180.0
// alpha = -alpha/2.0 + float64(ucam)*(alpha/float64(PANPixels))
// direction := []float64{0, math.Tan(alpha), -1.3}
@@ -33,16 +33,19 @@ func IntersectionAttitude(q Quaternion, satPos84 []float64, satTime time.Time, u
dECI := result.RawVector().Data
// -------- 转到ECEF坐标系 --------
x, y, z := ECItoECEF(dECI[0], dECI[1], dECI[2], satTime)
dECEF := []float64{x, y, z}
// x, y, z := ECItoECEF(dECI[0], dECI[1], dECI[2], satTime)
// dECEF := []float64{x, y, z}
// -------- 计算与地球表面的交点 --------
intersection, err := intersectWithEllipsoid(satPos84, dECEF)
intersection, err := intersectWithEllipsoid(satPosECI, dECI)
if err != nil {
return IntersectionPoint{}, err
}
lat, lon, h := ECEFToGeodetic(intersection[0], intersection[1], intersection[2])
x, y, z := ECItoECEF(intersection[0], intersection[1], intersection[2], satTime)
intersection = []float64{x, y, z}
lat, lon, h := ECEFGeocentricToGeodetic(intersection[0], intersection[1], intersection[2])
return IntersectionPoint{Lat: lat, Lon: lon, H: h}, nil
}
@@ -78,7 +81,7 @@ func IntersectionECI(Qsat2orbit, Qorbit2eci Quaternion, satPos84 []float64, satT
return IntersectionPoint{}, err
}
lat, lon, h := ECEFToGeodetic(intersection[0], intersection[1], intersection[2])
lat, lon, h := ECEFGeocentricToGeodetic(intersection[0], intersection[1], intersection[2])
return IntersectionPoint{Lat: lat, Lon: lon, H: h}, nil
}