Compute the bearing from start to end.

@param latS Start latitude, in radians
@param lngS Start longitude, in radians
@param latE End latitude, in radians
@param lngE End longitude, in radians
@return Bearing in degree
559973
public static double bearingRad(double latS, double lngS, double latE, double lngE) {
    final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine
    final double slatS = sinAndCos(latS, tmp), clatS = tmp.value;
    final double slatE = sinAndCos(latE, tmp), clatE = tmp.value;
    return atan2(-sin(lngS - lngE) * clatE, clatS * slatE - slatS * clatE * cos(lngS - lngE));
  }
496066
@Pure
	public static GeodesicPosition L1_WSG84(double x, double y) {
		final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
				LAMBERT_1_N,
				LAMBERT_1_C,
				LAMBERT_1_XS,
				LAMBERT_1_YS);
		return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY());
	}
756157
public static function between(
        $latitude1,
        $longitude1,
        $latitude2,
        $longitude2,
        $decimals = 1,
        $unit = 'km'
    ) {
        // define calculation variables
        $theta = $longitude1 - $longitude2;
        $distance = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2)))
            + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta)))
        ;
        $distance = acos($distance);
        $distance = rad2deg($distance);
        $distance = $distance * 60 * 1.1515;

        // unit is km
        if ($unit == 'km') {
            // redefine distance
            $distance = $distance * 1.609344;
        }

        // return with one decimal
        return round($distance, $decimals);
    }
1357979
def wgs84togcj02(lng, lat):
    
    if out_of_china(lng, lat):  # 判断是否在国内
        return lng, lat
    dlat = transformlat(lng - 105.0, lat - 35.0)
    dlng = transformlng(lng - 105.0, lat - 35.0)
    radlat = lat / 180.0 * pi
    magic = math.sin(radlat)
    magic = 1 - ee * magic * magic
    sqrtmagic = math.sqrt(magic)
    dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * pi)
    dlng = (dlng * 180.0) / (a / sqrtmagic * math.cos(radlat) * pi)
    mglat = lat + dlat
    mglng = lng + dlng
    return [mglng, mglat]
1260735
function getRotation(start, end) {
    // need two fingers
    if (start.length >= 2 && end.length >= 2) {
      return this.getAngle(end[1], end[0]) - this.getAngle(start[1], start[0]);
    }
    return 0;
  }
583409
def _decdeg_distance(pt1, pt2):
    

    lat1, lon1 = pt1
    lat2, lon2 = pt2

    # Convert decimal degrees to radians
    lon1, lat1, lon2, lat2 = map(np.radians, [lon1, lat1, lon2, lat2])

    # haversine formula
    dlon = lon2 - lon1
    dlat = lat2 - lat1
    a = np.sin(dlat/2)**2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon/2)**2
    c = 2 * np.arcsin(np.sqrt(a))
    km = 6367 * c

    return km
92960
private static function  mercatorLatRhumb( $lat1, $lat2,  $lng2,  $lng3) {
        
        return (MathUtil::mercator($lat1) * ($lng2 - $lng3) + MathUtil::mercator($lat2) * $lng3) / $lng2;
    }
584947
function XYZToLngLat([x, y, z]) {
  const lat = Math.atan2(z, Math.sqrt(x * x + y * y));
  const lng = Math.atan2(y, x);

  return [lng * RADIAN_TO_DEGREE, lat * RADIAN_TO_DEGREE];
}
1085434
public FillOptions withLatLngs(List<List<LatLng>> latLngs) {
    List<List<Point>> points = new ArrayList<>();
    for (List<LatLng> innerLatLngs : latLngs) {
      List<Point>innerList = new ArrayList<>();
      for (LatLng latLng : innerLatLngs) {
        innerList.add(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
      }
      points.add(innerList);
    }
    geometry = Polygon.fromLngLats(points);
    return this;
  }
1215706
private static function tanLatGC( $lat1,  $lat2,  $lng2,  $lng3) {
        return (tan($lat1) * sin($lng2 - $lng3) + tan($lat2) * sin($lng3)) / sin($lng2);
    }
360376
@Pure
	public static GeodesicPosition L3_WSG84(double x, double y) {
		final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
				LAMBERT_3_N,
				LAMBERT_3_C,
				LAMBERT_3_XS,
				LAMBERT_3_YS);
		return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY());
	}
1069917
def project(self, lng_lat):
        
        (lng, lat) = lng_lat
        x = lng * DEG_TO_RAD
        lat = max(min(MAX_LATITUDE, lat), -MAX_LATITUDE)
        y = lat * DEG_TO_RAD
        y = log(tan((pi / 4) + (y / 2)))
        return (x*EARTH_RADIUS, y*EARTH_RADIUS)
108666
def bearing_to(self, point):
        '''
        
        '''
        delta_long = point.long_radians - self.long_radians
        y = sin(delta_long) * cos(point.lat_radians)
        x = (
            cos(self.lat_radians) * sin(point.lat_radians) -
            sin(self.lat_radians) * cos(point.lat_radians) * cos(delta_long)
        )
        radians = math.atan2(y, x)
        return Bearing.from_radians(radians)
1138846
static double computeAngleBetween(IGeoPoint from, IGeoPoint to) {
        return distanceRadians(toRadians(from.getLatitude()), toRadians(from.getLongitude()),
            toRadians(to.getLatitude()), toRadians(to.getLongitude()));
    }
1137921
def bearing_to(other)
      dlat = to_radians(other.lat - lat)
      dlng = to_radians(other.lng - lng)
      bearing = Math.atan2(dlat, dlng)
      (90 - to_degrees(bearing) + 360) % 360
    end
1321556
public static double getLongitudeDistance(double minLongitude,
                                              double maxLongitude,
                                              double latitude) {
        LatLng leftMiddle = new LatLng(latitude, minLongitude);
        LatLng middle = new LatLng(latitude, (minLongitude + maxLongitude) / 2.0);
        LatLng rightMiddle = new LatLng(latitude, maxLongitude);

        List<LatLng> path = new ArrayList<LatLng>();
        path.add(leftMiddle);
        path.add(middle);
        path.add(rightMiddle);

        double lonDistance = SphericalUtil.computeLength(path);
        return lonDistance;
    }
1200330
public final double estimatedLongitude(long et)
    {
        et = correctedTime(et);
        lock.lock();
        try
        {
            calc();
            if (rateOfTurn == 0)
            {
                double dist = calcDist(et);
                return addLongitude(longitude, deltaLongitude(latitude, dist, bearing));
            }
            else
            {
                double deg = calcDeg(et);
                return addLongitude(centerLongitude, deltaLongitude(latitude, radius, deg));
            }
        }
        finally
        {
            lock.unlock();
        }
    }