GeometryUtils { public static boolean checkCoordinateBounds(final double lon, final double lat) { return (lon >= MIN_LON && lon <= MAX_LON && lat >= MIN_LAT && lat <= MAX_LAT); } private  GeometryUtils(); static double distance(final GeoCoordinates coord1,
                                  final GeoCoordinates coord2); static double distance(final double longitude1,
                                  final double latitude1, final double longitude2,
                                  final double latitude2); static double bearing(final GeoCoordinates coord1,
                                 final GeoCoordinates coord2); static double bearing(final double p1Longitude,
                                 final double p1Latitude, final double p2Longitude,
                                 final double p2Latitude); static double calculateLineBearing(final Line line,
                                              final BearingDirection dir, final int pointDistance,
                                              final int projectionAlongLine); static boolean checkCoordinateBounds(final double lon,
                                                final double lat); static GeoCoordinates intersectStraights(
            final GeoCoordinates coord1, final double bear1,
            final GeoCoordinates coord2, final double bear2); static GeoCoordinates intersectStraights(final double longitude1,
                                                    final double latitude1, final double bear1,
                                                    final double longitude2, final double latitude2, final double bear2); static boolean lineIntersection(final GeoCoordinates gc1Start,
                                           final GeoCoordinates gc1End, final GeoCoordinates gc2Start,
                                           final GeoCoordinates gc2End); static GeoCoordinates pointAlongLine(final GeoCoordinates coord1,
                                                final GeoCoordinates coord2, final double offset); static GeoCoordinates pointAlongLine(final double longitudeA,
                                                final double latitudeA, final double longitudeB,
                                                final double latitudeB, final double offset); static GeoCoordinates scaleUpperRightCoordinate(
            final GeoCoordinates lowerLeft, final GeoCoordinates upperRight,
            final double xfactor, final double yfactor); static GeoCoordinates scaleUpperRightCoordinate(
            final double lowerLeftLon, final double lowerLeftLat,
            final double upperRightLon, final double upperRightLat,
            final double xfactor, final double yfactor); static double round(final double val); static double round(final double val, final int decimalPlaces); static GeoCoordinates determineCoordinateInDistance(
            final GeoCoordinates coord, final int angle, final double distanceKm); static GeoCoordinates determineCoordinateInDistance(
            final double lon, final double lat, final int angle,
            final double distanceKm); static double bearingDifference(double firstBearing, double secondBearing); static final float MAX_LAT; static final float MIN_LAT; static final float MAX_LON; static final float MIN_LON; static final double ZERO_CIRCLE; static final double HALF_CIRCLE; static final double QUARTER_CIRCLE; static final double FULL_CIRCLE; static final double THREE_QUARTER_CIRCLE; static final int FULL_CIRCLE_DEGREE; }
@Test public final void testCoordinateBounds() { assertTrue(GeometryUtils.checkCoordinateBounds(HUNDRED_EIGHTY_DEGREE, NINETY_DEGREE)); assertTrue(GeometryUtils.checkCoordinateBounds(-1 * HUNDRED_EIGHTY_DEGREE, -1 * NINETY_DEGREE)); assertFalse(GeometryUtils.checkCoordinateBounds( HUNDRED_EIGHTY_DEGREE + 2, 0)); assertFalse(GeometryUtils.checkCoordinateBounds(0, NINETY_DEGREE + 2)); assertFalse(GeometryUtils.checkCoordinateBounds( -HUNDRED_EIGHTY_DEGREE - 2, 0)); assertFalse(GeometryUtils.checkCoordinateBounds(0, -NINETY_DEGREE - 2)); assertFalse(GeometryUtils.checkCoordinateBounds(HUNDRED_EIGHTY_DEGREE + VERY_SMALL, 0)); assertFalse(GeometryUtils.checkCoordinateBounds(0, -NINETY_DEGREE - VERY_SMALL)); assertFalse(GeometryUtils.checkCoordinateBounds(Double.MAX_VALUE, Double.MIN_VALUE)); }