EuclideanDoublePoint implements Clusterable<EuclideanDoublePoint>, Serializable { public double distanceFrom(final EuclideanDoublePoint p) { return MathArrays.distance(point, p.getPoint()); } EuclideanDoublePoint(final double[] point); EuclideanDoublePoint centroidOf(final Collection<EuclideanDoublePoint> points); double distanceFrom(final EuclideanDoublePoint p); @Override boolean equals(final Object other); double[] getPoint(); @Override int hashCode(); @Override String toString();  }
@Test public void testDistance() { final EuclideanDoublePoint e1 = new EuclideanDoublePoint(new double[] { -3.0, -2.0, -1.0, 0.0, 1.0 }); final EuclideanDoublePoint e2 = new EuclideanDoublePoint(new double[] { 1.0, 0.0, -1.0, 1.0, 1.0 }); 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); }