private void CheckDistance(IGeometry g1, IGeometry g2, double expectedDistance, double tolerance)
        {
            var    distOp = new Distance3DOp(g1, g2);
            double dist   = distOp.Distance();

            Assert.AreEqual(expectedDistance, dist, tolerance);
        }
        private void checkDistance(Geometry g1, Geometry g2, double expectedDistance, CoordinateZ[] expectedCoords, double tolerance)
        {
            var    distOp = new Distance3DOp(g1, g2);
            double dist   = distOp.Distance();

            Assert.That(dist, Is.EqualTo(expectedDistance).Within(tolerance));

            if (expectedCoords.Length == 2)
            {
                var nearestCoords = distOp.NearestPoints();
                Assert.IsTrue(nearestCoords[0].Equals2D(expectedCoords[0], tolerance));
                Assert.IsTrue(nearestCoords[1].Equals2D(expectedCoords[1], tolerance));
                if (!double.IsNaN(expectedCoords[0].Z))
                {
                    Assert.IsTrue(((CoordinateZ)nearestCoords[0]).EqualInZ(expectedCoords[0], tolerance));
                }
                if (!double.IsNaN(expectedCoords[1].Z))
                {
                    Assert.IsTrue(((CoordinateZ)nearestCoords[1]).EqualInZ((CoordinateZ)expectedCoords[1], tolerance));
                }
            }
        }