// EclipticPrecess precesses coordinates eclFrom, leaving result in eclTo. // // The same struct may be used for eclFrom and eclTo. // EclTo is returned for convenience. func (p *EclipticPrecessor) Precess(eclFrom, eclTo *coord.Ecliptic) *coord.Ecliptic { // (21.7) p. 137 sβ, cβ := math.Sincos(eclFrom.Lat) sd, cd := math.Sincos(p.π - eclFrom.Lon) A := p.cη*cβ*sd - p.sη*sβ B := cβ * cd C := p.cη*sβ + p.sη*cβ*sd eclTo.Lon = p.p + p.π - math.Atan2(A, B) if C < base.CosSmallAngle { eclTo.Lat = math.Asin(C) } else { eclTo.Lat = math.Acos(math.Hypot(A, B)) // near pole } return eclTo }
// EclipticPosition precesses ecliptic coordinates from one epoch to another, // including proper motions. // // While eclFrom is given as ecliptic coordinates, proper motions mα, mδ are // still expected to be equatorial. If proper motions are not to be considered // or are not applicable, pass 0, 0. // // Both eclFrom and eclTo must be non-nil, although they may point to the same // struct. EclTo is returned for convenience. func EclipticPosition(eclFrom, eclTo *coord.Ecliptic, epochFrom, epochTo float64, mα base.HourAngle, mδ base.Angle) *coord.Ecliptic { p := NewEclipticPrecessor(epochFrom, epochTo) *eclTo = *eclFrom if mα != 0 || mδ != 0 { mλ, mβ := eqProperMotionToEcl(mα.Rad(), mδ.Rad(), epochFrom, eclFrom) t := epochTo - epochFrom eclTo.Lon += mλ * t eclTo.Lat += mβ * t } return p.Precess(eclTo, eclTo) }
// EclipticPosition precesses ecliptic coordinates from one epoch to another, // including proper motions. // // While eclFrom is given as ecliptic coordinates, proper motions mα, mδ are // still expected to be equatorial. If proper motions are not to be considered // or are not applicable, pass 0, 0. // // Both eclFrom and eclTo must be non-nil, although they may point to the same // struct. EclTo is returned for convenience. func EclipticPosition(eclFrom, eclTo *coord.Ecliptic, epochFrom, epochTo float64, mα unit.HourAngle, mδ unit.Angle) *coord.Ecliptic { p := NewEclipticPrecessor(epochFrom, epochTo) *eclTo = *eclFrom if mα != 0 || mδ != 0 { mλ, mβ := eqProperMotionToEcl(mα, mδ, epochFrom, eclFrom) t := epochTo - epochFrom eclTo.Lon += mλ.Mul(t) eclTo.Lat += mβ.Mul(t) } return p.Precess(eclTo, eclTo) }