public void testRayCast() { // Static RayCast tests Assert.AreEqual(double.PositiveInfinity, testPolylineOpen.rayCast(new Ray2D(1.0d, 1.0d, -7.0d, -8.0d)), 0.000005d); Assert.AreEqual(System.Math.Sqrt(2), testPolylineOpen.rayCast(new Ray2D(1.0d, 1.0d, 4.0d, 4.0d)), 0.000005d); Assert.AreEqual(double.PositiveInfinity, testPolylineClosed.rayCast(new Ray2D(1.0d, 1.0d, -7.0d, -8.0d)), 0.000005d); Assert.AreEqual(System.Math.Sqrt(2), testPolylineClosed.rayCast(new Ray2D(1.0d, 1.0d, 4.0d, 4.0d)), 0.000005d); // Serial RayCast tests /*Point2D randomPoint; * Point2D randomPointOnEdge; * Line2D currentEdge; * int counter = 500; * do { * for (int i = 1; i < testVertices.Length;++i){ * currentEdge = new Line2D(testVertices[i], testVertices[i-1]); * randomPointOnEdge = currentEdge.randomPoint(); * randomPoint = new Point2D(Util.generateRandomDoubleBetween(-1000.0d, 1000.0d), Util.generateRandomDoubleBetween(-1000.0d, 1000.0d)); * AreEqual("Serial rayCast test for Polyline2D (open).", randomPoint.distance(randomPointOnEdge), testPolylineOpen.rayCast(new Ray2D(randomPoint,randomPoint.vec(randomPointOnEdge))), 0.000005d); * } * counter -= 1; * } while (counter > 0);*/ }