@Test public void testAngles() { assertTrue( GeometryHullTool.calcAngle( new Coordinate(39, 41.5), new Coordinate(41, 41), new Coordinate(38, 41.2)) > 0); assertTrue( GeometryHullTool.calcAngle( new Coordinate(39, 41.5), new Coordinate(41, 41), new Coordinate(38, 43)) < 0); assertTrue( GeometryHullTool.calcAngle( new Coordinate(39, 41.5), new Coordinate(41, 41), new Coordinate(38, 41.2)) < GeometryHullTool.calcAngle( new Coordinate(39, 41.5), new Coordinate(41, 41), new Coordinate(38, 41.1))); assertTrue( GeometryHullTool.calcAngle( new Coordinate(39, 41.5), new Coordinate(41, 41), new Coordinate(38, 43)) > GeometryHullTool.calcAngle( new Coordinate(39, 41.5), new Coordinate(41, 41), new Coordinate(38, 44))); assertTrue( GeometryHullTool.calcAngle( new Coordinate(42, 42), new Coordinate(41, 41), new Coordinate(42.5, 44)) > 0); assertTrue( GeometryHullTool.calcAngle( new Coordinate(42, 42), new Coordinate(41, 41), new Coordinate(42.5, 40.5)) < 0); assertEquals( -90.0, GeometryHullTool.calcAngle( new Coordinate(41, 42), new Coordinate(41, 41), new Coordinate(42, 41)), 0.001); assertEquals( 90.0, GeometryHullTool.calcAngle( new Coordinate(42, 41), new Coordinate(41, 41), new Coordinate(41, 42)), 0.001); assertEquals( -180, GeometryHullTool.calcAngle( new Coordinate(42, 42), new Coordinate(41, 41), new Coordinate(40, 40)), 0.001); assertEquals( 0, GeometryHullTool.calcAngle( new Coordinate(42, 42), new Coordinate(41, 41), new Coordinate(42, 42)), 0.001); assertEquals( -315, GeometryHullTool.calcAngle( new Coordinate(41, 41), new Coordinate(42, 41), new Coordinate(41, 40)), 0.001); assertEquals( -45, GeometryHullTool.calcAngle( new Coordinate(42, 41), new Coordinate(41, 41), new Coordinate(42, 40)), 0.001); assertEquals( -45, GeometryHullTool.calcAngle( new Coordinate(41, 42), new Coordinate(41, 41), new Coordinate(42, 42)), 0.001); }
public static double calcAngle( final Coordinate one, final Coordinate vertex, final Coordinate two) { final double p1x = one.x - vertex.x; final double p1y = one.y - vertex.y; final double p2x = two.x - vertex.x; final double p2y = two.y - vertex.y; final double angle1 = Math.toDegrees(Math.atan2(p1y, p1x)); final double angle2 = Math.toDegrees(Math.atan2(p2y, p2x)); return angle2 - angle1; }
GeometryHullTool { public static double calcAngle( final Coordinate one, final Coordinate vertex, final Coordinate two) { final double p1x = one.x - vertex.x; final double p1y = one.y - vertex.y; final double p2x = two.x - vertex.x; final double p2y = two.y - vertex.y; final double angle1 = Math.toDegrees(Math.atan2(p1y, p1x)); final double angle2 = Math.toDegrees(Math.atan2(p2y, p2x)); return angle2 - angle1; } }
GeometryHullTool { public static double calcAngle( final Coordinate one, final Coordinate vertex, final Coordinate two) { final double p1x = one.x - vertex.x; final double p1y = one.y - vertex.y; final double p2x = two.x - vertex.x; final double p2y = two.y - vertex.y; final double angle1 = Math.toDegrees(Math.atan2(p1y, p1x)); final double angle2 = Math.toDegrees(Math.atan2(p2y, p2x)); return angle2 - angle1; }  }
GeometryHullTool { public static double calcAngle( final Coordinate one, final Coordinate vertex, final Coordinate two) { final double p1x = one.x - vertex.x; final double p1y = one.y - vertex.y; final double p2x = two.x - vertex.x; final double p2y = two.y - vertex.y; final double angle1 = Math.toDegrees(Math.atan2(p1y, p1x)); final double angle2 = Math.toDegrees(Math.atan2(p2y, p2x)); return angle2 - angle1; }  void connect(final List<Geometry> geometries); DistanceFn<Coordinate> getDistanceFnForCoordinate(); void setDistanceFnForCoordinate(final DistanceFn<Coordinate> distanceFnForCoordinate); Geometry createHullFromGeometry(
      final Geometry clusterGeometry,
      final Collection<Coordinate> additionalPoints,
      final boolean fast); Geometry concaveHullParkOhMethod(
      final Geometry geometry,
      final Collection<Coordinate> providedInnerPoints); Geometry concaveHull(
      final Geometry geometry,
      final Collection<Coordinate> providedInnerPoints); static boolean intersectAnotherEdge(final Edge newEdge, final Edge edgeToReplace); static boolean edgesIntersect(final Edge e1, final Edge e2); Geometry connect(final Geometry shape1, final Geometry shape2); static boolean clockwise(final Coordinate[] set); static double calcSmallestAngle(
      final Coordinate one,
      final Coordinate vertex,
      final Coordinate two); static double calcAngle(
      final Coordinate one,
      final Coordinate vertex,
      final Coordinate two); static double[] calcDistanceSegment(
      final Coordinate start,
      final Coordinate end,
      final Coordinate point); static double calcDistance(
      final Coordinate start,
      final Coordinate end,
      final Coordinate point); static Pair<Integer, Integer> getClosestPoints(
      final Geometry shape1,
      final Geometry shape2,
      final DistanceFn<Coordinate> distanceFnForCoordinate); }
GeometryHullTool { public static double calcAngle( final Coordinate one, final Coordinate vertex, final Coordinate two) { final double p1x = one.x - vertex.x; final double p1y = one.y - vertex.y; final double p2x = two.x - vertex.x; final double p2y = two.y - vertex.y; final double angle1 = Math.toDegrees(Math.atan2(p1y, p1x)); final double angle2 = Math.toDegrees(Math.atan2(p2y, p2x)); return angle2 - angle1; }  void connect(final List<Geometry> geometries); DistanceFn<Coordinate> getDistanceFnForCoordinate(); void setDistanceFnForCoordinate(final DistanceFn<Coordinate> distanceFnForCoordinate); Geometry createHullFromGeometry(
      final Geometry clusterGeometry,
      final Collection<Coordinate> additionalPoints,
      final boolean fast); Geometry concaveHullParkOhMethod(
      final Geometry geometry,
      final Collection<Coordinate> providedInnerPoints); Geometry concaveHull(
      final Geometry geometry,
      final Collection<Coordinate> providedInnerPoints); static boolean intersectAnotherEdge(final Edge newEdge, final Edge edgeToReplace); static boolean edgesIntersect(final Edge e1, final Edge e2); Geometry connect(final Geometry shape1, final Geometry shape2); static boolean clockwise(final Coordinate[] set); static double calcSmallestAngle(
      final Coordinate one,
      final Coordinate vertex,
      final Coordinate two); static double calcAngle(
      final Coordinate one,
      final Coordinate vertex,
      final Coordinate two); static double[] calcDistanceSegment(
      final Coordinate start,
      final Coordinate end,
      final Coordinate point); static double calcDistance(
      final Coordinate start,
      final Coordinate end,
      final Coordinate point); static Pair<Integer, Integer> getClosestPoints(
      final Geometry shape1,
      final Geometry shape2,
      final DistanceFn<Coordinate> distanceFnForCoordinate);  }