public void EuclideanMetric_Dist2_Test() { var metric = new EuclideanMetric(); var p1 = new double[] { 1.0F, 0.0F }; var p2 = new double[] { 0.0F, 1.0F }; var p3 = new double[] { 1.0F, 3.0F }; var d12 = metric.Dist2(p1, p2); var d21 = metric.Dist2(p2, p1); var d13 = metric.Dist2(p1, p3); var d31 = metric.Dist2(p3, p1); var d23 = metric.Dist2(p2, p3); var d32 = metric.Dist2(p3, p2); Assert.AreEqual(2.0F, d12, EPS); Assert.AreEqual(2.0F, d21, EPS); Assert.AreEqual(9.0F, d13, EPS); Assert.AreEqual(9.0F, d31, EPS); Assert.AreEqual(5.0F, d32, EPS); Assert.AreEqual(5.0F, d23, EPS); }