Exemplo n.º 1
0
        public void NotIntersectingSphereWithAntiSphereAndRayFromInsideBothFrontFacingBackWillReturnNull()
        {
            Sphere     s     = new Sphere(0, new Vector3(0, 0, 0), Color.Black, 2.999f);
            AntiSphere antis = new AntiSphere(0, new Vector3(0, 0, 2), Color.White, 2f);

            s.AddAntiSphere(antis);

            Assert.AreEqual <Intersection>(
                new Intersection(true),
                s.Intersect(new RealtimeRaytrace.Ray(new Vector3(0, 0, 2), new Vector3(0, 0, 1))));
        }
Exemplo n.º 2
0
        public void IntersectingSphereWithAntiSphereAndRayFromInsideBothFrontWillReturnValidIntersection()
        {
            Sphere     s     = new Sphere(0, new Vector3(0, 0, 0), Color.Black, 2.999f);
            AntiSphere antis = new AntiSphere(0, new Vector3(0, 0, 2), Color.White, 2f);

            s.AddAntiSphere(antis);

            Assert.AreEqual <String>(
                (new Intersection(
                     new Vector3(0, 0, 0f),
                     new Vector3(0, 0, 1f),
                     new Vector3(0, 0, 1f),
                     2f,
                     2f,
                     float.MaxValue,
                     antis)).ToString(),
                s.Intersect(new RealtimeRaytrace.Ray(new Vector3(0, 0, 2), new Vector3(0, 0, -1))).ToString());
        }