示例#1
0
        public void IntersectTest()
        {
            MBB mbb2 = new MBB(new Point(0, 0, 0), new Point(2, 2, 2));
            Ray ray  = new Ray(new Point(-1, 0, 0), new Point(-4, 1, 1));

            Assert.AreEqual(mbb2.Intersects(ray), false);
        }
示例#2
0
        public void VolumeChangeTest()
        {
            MBB mbb1 = new MBB(new Point(0, 0, 0), new Point(2, 2, 8));
            MBB mbb2 = new MBB(new Point(0, 0, 0), new Point(2, 2, 2));

            Assert.AreEqual(-30, MBB.CheckVolumeChange(mbb1, mbb2, new Point(3, 3, 0)));
        }
示例#3
0
        public void OverlapVolumeChangeTest()
        {
            MBB mbb1 = new MBB(new Point(0, 0, 0), new Point(2, 2, 2));
            MBB mbb2 = new MBB(new Point(1, 1, 1), new Point(4, 4, 4));

            Assert.AreEqual(0, MBB.CheckOverlapChange(mbb2, mbb1, new Point(2, 2, 2)));
        }
示例#4
0
        public void OverlapVolumeTest()
        {
            MBB mbb1 = new MBB(new Point(0, 0, 0), new Point(2, 2, 2));
            MBB mbb2 = new MBB(new Point(1, 1, 1), new Point(2, 2, 2));

            Assert.AreEqual(1, MBB.CheckOverlapVolume(mbb1, mbb2));
        }
示例#5
0
        public void MBBCreationTest()
        {
            MBB      mbb      = new MBB();
            Triangle triangle = new Triangle(new Point(1, -1, 2),
                                             new Point(4, 2, 7), new Point(-5, 5, -6));

            mbb.AddTriangle(triangle);
            Assert.AreEqual(-5, mbb._xMin);
            Assert.AreEqual(4, mbb._xMax);
            Assert.AreEqual(-1, mbb._yMin);
            Assert.AreEqual(5, mbb._yMax);
            Assert.AreEqual(-6, mbb._zMin);
            Assert.AreEqual(7, mbb._zMax);
        }
示例#6
0
        public void AnotherCtorTest()
        {
            MBB      mbb      = new MBB();
            Triangle triangle = new Triangle(new Point(1, -1, 2),
                                             new Point(4, 2, 7), new Point(-5, 5, -6));

            mbb.AddTriangle(triangle);
            MBB mbb1 = new MBB(triangle);

            Assert.AreEqual(mbb1._xMin, mbb._xMin);
            Assert.AreEqual(mbb1._xMax, mbb._xMax);
            Assert.AreEqual(mbb1._yMin, mbb._yMin);
            Assert.AreEqual(mbb1._yMax, mbb._yMax);
            Assert.AreEqual(mbb1._zMin, mbb._zMin);
            Assert.AreEqual(mbb1._zMax, mbb._zMax);
        }