示例#1
0
        public void TestAabbTransform()
        {
            Random rnd = new Random(0x12345678);

            for (int i = 0; i < 100; i++)
            {
                quaternion r = rnd.NextQuaternionRotation();
                float3     t = rnd.NextFloat3();

                Aabb orig = new Aabb();
                orig.Include(rnd.NextFloat3());
                orig.Include(rnd.NextFloat3());

                Aabb outAabb1 = Unity.Physics.Math.TransformAabb(new RigidTransform(r, t), orig);

                Physics.Math.MTransform bFromA = new Physics.Math.MTransform(r, t);
                Aabb outAabb2 = Unity.Physics.Math.TransformAabb(bFromA, orig);

                TestUtils.AreEqual(outAabb1.Min, outAabb2.Min, 1e-3f);
                TestUtils.AreEqual(outAabb1.Max, outAabb2.Max, 1e-3f);
            }
        }