Frechet { public static double discreteFrechet(ILineString p, ILineString q) { int sizeP = p.sizeControlPoint(); int sizeQ = q.sizeControlPoint(); double[][] ca = new double[sizeP][sizeQ]; for (int i = 0; i < sizeP; i++) { for (int j = 0; j < sizeQ; j++) { ca[i][j] = -1.0; } } double d = discreteFrechetCouplingMeasure(p, q, sizeP - 1, sizeQ - 1, ca); return d; }  static double discreteFrechet(ILineString p, ILineString q); static double discreteFrechetWithProjection(ILineString p,
      ILineString q); static double partialFrechet(ILineString p, ILineString q); static double[] freeCellEllipse(IDirectPosition p1,
      IDirectPosition p2, IDirectPosition q1, IDirectPosition q2); static IPolygon[][] freeSpaceDiagram(IDirectPositionList p,
      IDirectPositionList q, double sigma); static double[][][][] fsdCalculation(IDirectPositionList p,
      IDirectPositionList q, double sigma); static double[] boundary(IDirectPosition p, IDirectPosition q1,
      IDirectPosition q2, double r); static DirectPosition[] circleLineIntersect(double x1, double y1,
      double x2, double y2, double cx, double cy, double cr); static int pointOnSegment(double x1, double y1, double x2, double y2,
      double x3, double y3); static double distance(double x1, double y1, double x2, double y2);  }
@Test public void testDiscreteFrechet() { ILineString p = new GM_LineString(new DirectPosition(311, 747), new DirectPosition(805, 746), new DirectPosition(285, 424), new DirectPosition(990, 428)); ILineString q = new GM_LineString(new DirectPosition(301, 629), new DirectPosition(438, 773), new DirectPosition(528, 727), new DirectPosition(674, 769), new DirectPosition(829, 742), new DirectPosition(282, 506), new DirectPosition(903, 401), new DirectPosition(954, 483)); System.out.println(p); System.out.println(q); double d = Frechet.discreteFrechet(p, q); System.out.println(d); d = Frechet.discreteFrechetWithProjection(p, q); System.out.println(d); p = new GM_LineString(new DirectPosition(283, 253), new DirectPosition(835, 296), new DirectPosition(859, 52)); q = new GM_LineString(new DirectPosition(282, 264), new DirectPosition(470.35780999672346, 267.5949018656868), new DirectPosition(537, 186), new DirectPosition(682, 303), new DirectPosition(911, 266), new DirectPosition(811, 41)); d = Frechet.discreteFrechet(p, q); System.out.println(d); d = Frechet.discreteFrechetWithProjection(p, q); System.out.println(d); }