31 double centroidx = start.x;
32 double centroidy = start.y;
34 double totalWeight = 0;
35 for (
int i = 0; i < points.length; i++) {
36 Coordinate pt = points[i];
37 double weight = 1 /
distance(pt.x, pt.y, centroidx, centroidy);
40 totalWeight += weight;
44 }
while (Math.abs(cx - centroidx) > 0.5
45 || Math.abs(cy - centroidy) > 0.5);
48 return new Coordinate(cx, cy);
static double distance(double x1, double y1, double x2, double y2)
Definition: openrdf/query/algebra/evaluation/function/postgis/point/GeometricMedian.java:51