EuclideanIntegerPoint implements Clusterable<EuclideanIntegerPoint>, Serializable { public double distanceFrom(final EuclideanIntegerPoint p) { return MathArrays.distance(point, p.getPoint()); } EuclideanIntegerPoint(final int[] point); int[] getPoint(); double distanceFrom(final EuclideanIntegerPoint p); EuclideanIntegerPoint centroidOf(final Collection<EuclideanIntegerPoint> points); @Override boolean equals(final Object other); @Override int hashCode(); @Override String toString();  }
@Test public void testDistance() { EuclideanIntegerPoint e1 = new EuclideanIntegerPoint(new int[] { -3, -2, -1, 0, 1 }); EuclideanIntegerPoint e2 = new EuclideanIntegerPoint(new int[] { 1, 0, -1, 1, 1 }); Assert.assertEquals(FastMath.sqrt(21.0), e1.distanceFrom(e2), 1.0e-15); Assert.assertEquals(0.0, e1.distanceFrom(e1), 1.0e-15); Assert.assertEquals(0.0, e2.distanceFrom(e2), 1.0e-15); }