SphericalGeometryLibrary { public static CoordinatePoint projectPointToSegmentAppropximate( CoordinatePoint point, CoordinatePoint segmentStart, CoordinatePoint segmentEnd) { XYPoint pPoint = new XYPoint(point.getLon(), point.getLat()); XYPoint pSegmentStart = new XYPoint(segmentStart.getLon(), segmentStart.getLat()); XYPoint pSegmentEnd = new XYPoint(segmentEnd.getLon(), segmentEnd.getLat()); XYPoint pResult = GeometryLibrary.projectPointToSegment(pPoint, pSegmentStart, pSegmentEnd); return new CoordinatePoint(pResult.getY(), pResult.getX()); }  static double distanceFaster(double lat1, double lon1, double lat2,
      double lon2); static final double distance(double lat1, double lon1, double lat2,
      double lon2); static final double distance(CoordinatePoint a, CoordinatePoint b); static final double distance(double lat1, double lon1, double lat2,
      double lon2, double radius); static final CoordinateBounds bounds(CoordinatePoint point,
      double distance); static CoordinateBounds bounds(CoordinateBounds b, double distance); static final CoordinateBounds bounds(double lat, double lon,
      double distance); static final CoordinateBounds bounds(double lat, double lon,
      double latDistance, double lonDistance); static final CoordinateBounds boundsFromLatLonOffset(double lat,
      double lon, double latOffset, double lonOffset); static final CoordinateBounds boundsFromLatLonSpan(double lat,
      double lon, double latSpan, double lonSpan); static CoordinatePoint getCenterOfBounds(CoordinateBounds b); static double getOrientation(double latFrom, double lonFrom,
      double latTo, double lonTo); static CoordinatePoint projectPointToSegmentAppropximate(
      CoordinatePoint point, CoordinatePoint segmentStart,
      CoordinatePoint segmentEnd); static final double RADIUS_OF_EARTH_IN_KM; static final double COS_MAX_LAT; static final double METERS_PER_DEGREE_AT_EQUATOR; }
@Test public void testProjectPointToSegmentApproximate() { CoordinatePoint p = new CoordinatePoint(40.737284, -73.955430); CoordinatePoint seg1 = new CoordinatePoint(40.737997, -73.955472); CoordinatePoint seg2 = new CoordinatePoint(40.734575, -73.954979); CoordinatePoint r = SphericalGeometryLibrary.projectPointToSegmentAppropximate( p, seg1, seg2); assertEquals(40.73729256997116, r.getLat(), 0.0); assertEquals(-73.95537051431788, r.getLon(), 0.0); }