예제 #1
0
        public void RayToRayCovergentNonOverlapping()
        {
            Ray2D ray1 = new Ray2D(new Point2D(0.0, 0.0), new Direction2D(0.0, 1.0));
            Ray2D ray2 = new Ray2D(new Point2D(-1.0, -2.0), new Direction2D(1.0, 1.0));

            Point2D result;

            Intersector.Intersection intersection = Intersector.Intersect(ray1, ray2, out result);
            Assert.AreEqual(Intersector.Intersection.DontIntersect, intersection);
        }
예제 #2
0
        public void SegmentToSegmentParallel()
        {
            Segment2D segment1 = new Segment2D(new Point2D(0.0, 0.0), new Point2D(1.0, 0.0));
            Segment2D segment2 = new Segment2D(new Point2D(0.0, 1.0), new Point2D(1.0, 1.0));

            Point2D result;

            Intersector.Intersection intersection = Intersector.Intersect(segment1, segment2, out result);
            Assert.AreEqual(Intersector.Intersection.DontIntersect, intersection);
        }
예제 #3
0
        public void RayToRayParallelIntersect()
        {
            Ray2D ray1 = new Ray2D(new Point2D(0.0, 0.0), new Direction2D(0.0, 1.0));
            Ray2D ray2 = new Ray2D(new Point2D(1.0, 0.0), new Direction2D(0.0, 1.0));

            Point2D result;

            Intersector.Intersection intersection = Intersector.Intersect(ray1, ray2, out result);
            Assert.AreEqual(Intersector.Intersection.DontIntersect, intersection);
        }
예제 #4
0
        public void RayToLineDiverging()
        {
            Ray2D  ray  = new Ray2D(new Point2D(0.0, 0.0), new Direction2D(-1.0, 1.0));
            Line2D line = new Line2D(new Point2D(1.0, 0.0), new Point2D(1.0, 1.0));

            Point2D result;

            Intersector.Intersection intersection = Intersector.Intersect(ray, line, out result);
            Assert.AreEqual(Intersector.Intersection.DontIntersect, intersection);
        }
예제 #5
0
        public void RayToRayGlancing()
        {
            Ray2D rayA = new Ray2D(new Point2D(4.0, 0.0), new Direction2D(-1.0, -1.0));
            Ray2D rayB = new Ray2D(new Point2D(2.0, 2.0), new Direction2D(0.0, -Math.Sqrt(2.0)));

            Point2D result;

            Intersector.Intersection intersection = Intersector.Intersect(rayA, rayB, out result);
            Assert.AreEqual(Intersector.Intersection.DoIntersect, intersection);
            Assert.AreEqual(new Point2D(2.0, -2.0), result);
        }
예제 #6
0
        public void RayToRayOrderIndependence2()
        {
            Ray2D rayA = new Ray2D(new Point2D(0.0, 0.0), new Direction2D(0.0, 1.0));
            Ray2D rayB = new Ray2D(new Point2D(2.0, 1.0), new Direction2D(1.0, 1.0));

            Point2D resultAB;

            Intersector.Intersection intersectionAB = Intersector.Intersect(rayA, rayB, out resultAB);

            Point2D resultBA;

            Intersector.Intersection intersectionBA = Intersector.Intersect(rayB, rayA, out resultBA);

            Assert.AreEqual(intersectionAB, intersectionBA);
            Assert.AreEqual(resultAB, resultBA);
        }