public void TestClosestOnSurface() { AABB box = new AABB(Vector.Create(-1.0, -1.0), Vector.Create(1.0, 1.0)); IVector closest = box.Closest(Vector.Create(-2.0, -0.5)); Assert.AreEqual(-1.0, closest[0], FloatComparison.DefaultEps); Assert.AreEqual(-0.5, closest[1], FloatComparison.DefaultEps); closest = box.Closest(Vector.Create(3.0, 3.0)); Assert.AreEqual(1.0, closest[0], FloatComparison.DefaultEps); Assert.AreEqual(1.0, closest[1], FloatComparison.DefaultEps); closest = box.Closest(Vector.Create(0.5, 0.5)); Assert.AreEqual(0.5, closest[0], FloatComparison.DefaultEps); Assert.AreEqual(0.5, closest[1], FloatComparison.DefaultEps); }