topocentric method

Topocentric topocentric(
  1. LatLngAlt observer,
  2. EarthCenteredEarthFixed satellite
)

Calculates Topocentrics.

Implementation

Topocentric topocentric(
  LatLngAlt observer,
  EarthCenteredEarthFixed satellite,
) {
  final longitude = observer.longitude.radians;
  final latitude = observer.latitude.radians;
  final earthCenteredEarthFixed = observer.toEcf(this);
  final dx = satellite.x - earthCenteredEarthFixed.x;
  final dy = satellite.y - earthCenteredEarthFixed.y;
  final dz = satellite.z - earthCenteredEarthFixed.z;

  final south = sin(latitude) * cos(longitude) * dx +
      sin(latitude) * sin(longitude) * dy -
      cos(latitude) * dz;
  final east = (0.0 - sin(longitude)) * dx + cos(longitude) * dy;
  final normal = cos(latitude) * cos(longitude) * dx +
      cos(latitude) * sin(longitude) * dy +
      sin(latitude) * dz;

  return Topocentric(south: south, east: east, normal: normal);
}