Exemple #1
0
        public void ComputeCollision()
        {
            CollisionDetection cd = new CollisionDetection();

            CombinedCollisionAlgorithm cca = new CombinedCollisionAlgorithm(cd, new SphereSphereAlgorithm(cd), new SphereSphereAlgorithm(cd));

            CollisionObject a = new CollisionObject(new GeometricObject
            {
                Shape = new SphereShape(1),
            });

            CollisionObject b = new CollisionObject(new GeometricObject
            {
                Shape = new SphereShape(1),
                Pose  = new Pose(new Vector3(3, 0, 0)),
            });

            ContactSet set = cca.GetClosestPoints(a, b);

            Assert.AreEqual(1, set.Count);

            set = cca.GetContacts(a, b);
            Assert.IsTrue(set == null || set.Count == 0);

            ((GeometricObject)b.GeometricObject).Pose = new Pose(new Vector3(2, 0, 0));

            set = cca.GetClosestPoints(a, b);
            Assert.AreEqual(1, set.Count);

            set = cca.GetContacts(a, b);
            Assert.AreEqual(1, set.Count);
        }
Exemple #2
0
        public void ComputeCollision()
        {
            CollisionDetection cd = new CollisionDetection();

              CombinedCollisionAlgorithm cca = new CombinedCollisionAlgorithm(cd, new SphereSphereAlgorithm(cd), new SphereSphereAlgorithm(cd));

              CollisionObject a = new CollisionObject(new GeometricObject
            {
              Shape = new SphereShape(1),
            });

              CollisionObject b = new CollisionObject(new GeometricObject
            {
              Shape = new SphereShape(1),
              Pose = new Pose(new Vector3F(3, 0, 0)),
            });

              ContactSet set = cca.GetClosestPoints(a, b);
              Assert.AreEqual(1, set.Count);

              set = cca.GetContacts(a, b);
              Assert.IsTrue(set == null || set.Count == 0);

              ((GeometricObject)b.GeometricObject).Pose = new Pose(new Vector3F(2, 0, 0));

              set = cca.GetClosestPoints(a, b);
              Assert.AreEqual(1, set.Count);

              set = cca.GetContacts(a, b);
              Assert.AreEqual(1, set.Count);
        }
Exemple #3
0
        public void ComputeCollision2()
        {
            // Use TestAlgo to test if GetClosestPoint returns only 1 contact.
              CollisionDetection cd = new CollisionDetection();
              CombinedCollisionAlgorithm cca = new CombinedCollisionAlgorithm(cd, new TestAlgo(cd), new TestAlgo(cd));

              CollisionObject a = new CollisionObject();
              CollisionObject b = new CollisionObject();

              ContactSet set = cca.GetClosestPoints(a, b);
              // Test algo returns 2 contacts. One is filtered out because a closest-point query should return only 1 contact.
              Assert.AreEqual(1, set.Count);
              Assert.AreEqual(1.2f, set[0].PenetrationDepth);
        }
Exemple #4
0
        public void ComputeCollision2()
        {
            // Use TestAlgo to test if GetClosestPoint returns only 1 contact.
            CollisionDetection         cd  = new CollisionDetection();
            CombinedCollisionAlgorithm cca = new CombinedCollisionAlgorithm(cd, new TestAlgo(cd), new TestAlgo(cd));

            CollisionObject a = new CollisionObject();
            CollisionObject b = new CollisionObject();

            ContactSet set = cca.GetClosestPoints(a, b);

            // Test algo returns 2 contacts. One is filtered out because a closest-point query should return only 1 contact.
            Assert.AreEqual(1, set.Count);
            Assert.AreEqual(1.2f, set[0].PenetrationDepth);
        }
Exemple #5
0
        public void TouchingButNotTouching()
        {
            // Special case: GJK reports contact, MPR cannot find the contact.
            // This happens for perfectly touching quadrics.

            CollisionDetection         cd  = new CollisionDetection();
            CombinedCollisionAlgorithm cca = new CombinedCollisionAlgorithm(cd, new Gjk(cd), new MinkowskiPortalRefinement(cd));

            CollisionObject a = new CollisionObject();

            ((GeometricObject)a.GeometricObject).Shape = new ConeShape(2, 2);

            CollisionObject b = new CollisionObject();

            ((GeometricObject)b.GeometricObject).Shape = new CircleShape(2);
            ((GeometricObject)b.GeometricObject).Pose  = new Pose(new Vector3(4, 0, 0));

            Assert.AreEqual(false, cca.HaveContact(a, b));
            Assert.AreEqual(0, cca.GetContacts(a, b).Count);
            Assert.IsTrue(cca.GetClosestPoints(a, b)[0].PenetrationDepth < 0);
        }
Exemple #6
0
        public void TouchingButNotTouching()
        {
            // Special case: GJK reports contact, MPR cannot find the contact.
              // This happens for perfectly touching quadrics.

              CollisionDetection cd = new CollisionDetection();
              CombinedCollisionAlgorithm cca = new CombinedCollisionAlgorithm(cd, new Gjk(cd), new MinkowskiPortalRefinement(cd));

              CollisionObject a = new CollisionObject();
              ((GeometricObject)a.GeometricObject).Shape = new ConeShape(2, 2);

              CollisionObject b = new CollisionObject();
              ((GeometricObject)b.GeometricObject).Shape = new CircleShape(2);
              ((GeometricObject)b.GeometricObject).Pose = new Pose(new Vector3F(4, 0, 0));

              Assert.AreEqual(false, cca.HaveContact(a, b));
              Assert.AreEqual(0, cca.GetContacts(a, b).Count);
              Assert.IsTrue(cca.GetClosestPoints(a, b)[0].PenetrationDepth < 0);
        }
Exemple #7
0
        public CollisionAlgorithmMatrix(CollisionDetection collisionDetection)
        {
            // Initialize with dummy collision algorithms.
            var noAlgo       = new NoCollisionAlgorithm(collisionDetection);   // Definitely no collision wanted.
            var infiniteAlgo = new InfiniteShapeAlgorithm(collisionDetection); // Returns always a collision.

            // Build default configuration:
            var gjk                = new Gjk(collisionDetection);
            var gjkBoxAlgorithm    = new CombinedCollisionAlgorithm(collisionDetection, gjk, new BoxBoxAlgorithm(collisionDetection));
            var gjkMprAlgorithm    = new CombinedCollisionAlgorithm(collisionDetection, gjk, new MinkowskiPortalRefinement(collisionDetection));
            var gjkTriTriAlgorithm = new CombinedCollisionAlgorithm(collisionDetection, gjk, new TriangleTriangleAlgorithm(collisionDetection));

            BoxSphereAlgorithm        boxSphereAlgorithm        = new BoxSphereAlgorithm(collisionDetection);
            CompositeShapeAlgorithm   compositeAlgorithm        = new CompositeShapeAlgorithm(collisionDetection);
            HeightFieldAlgorithm      heightFieldAlgorithm      = new HeightFieldAlgorithm(collisionDetection);
            LineAlgorithm             lineAlgorithm             = new LineAlgorithm(collisionDetection);
            PlaneBoxAlgorithm         planeBoxAlgorithm         = new PlaneBoxAlgorithm(collisionDetection);
            PlaneConvexAlgorithm      planeConvexAlgorithm      = new PlaneConvexAlgorithm(collisionDetection);
            PlaneRayAlgorithm         planeRayAlgorithm         = new PlaneRayAlgorithm(collisionDetection);
            PlaneSphereAlgorithm      planeSphereAlgorithm      = new PlaneSphereAlgorithm(collisionDetection);
            RayBoxAlgorithm           rayBoxAlgorithm           = new RayBoxAlgorithm(collisionDetection);
            RayConvexAlgorithm        rayConvexAlgorithm        = new RayConvexAlgorithm(collisionDetection);
            RaySphereAlgorithm        raySphereAlgorithm        = new RaySphereAlgorithm(collisionDetection);
            RayTriangleAlgorithm      rayTriangleAlgorithm      = new RayTriangleAlgorithm(collisionDetection);
            SphereSphereAlgorithm     sphereSphereAlgorithm     = new SphereSphereAlgorithm(collisionDetection);
            TransformedShapeAlgorithm transformedShapeAlgorithm = new TransformedShapeAlgorithm(collisionDetection);
            TriangleMeshAlgorithm     triangleMeshAlgorithm     = new TriangleMeshAlgorithm(collisionDetection);
            RayCompositeAlgorithm     rayCompositeAlgorithm     = new RayCompositeAlgorithm(collisionDetection);
            RayTriangleMeshAlgorithm  rayTriangleMeshAlgorithm  = new RayTriangleMeshAlgorithm(collisionDetection);
            RayHeightFieldAlgorithm   rayHeightFieldAlgorithm   = new RayHeightFieldAlgorithm(collisionDetection);

            this[typeof(PointShape), typeof(PointShape)]        = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(LineShape)]         = lineAlgorithm;
            this[typeof(PointShape), typeof(RayShape)]          = rayConvexAlgorithm;
            this[typeof(PointShape), typeof(LineSegmentShape)]  = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(TriangleShape)]     = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(RectangleShape)]    = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(BoxShape)]          = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(ConvexShape)]       = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(ScaledConvexShape)] = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(CircleShape)]       = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(SphereShape)]       = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(PointShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(PointShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(PointShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(PointShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(PointShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(PointShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(PointShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(LineShape), typeof(LineShape)]         = lineAlgorithm;
            this[typeof(LineShape), typeof(RayShape)]          = lineAlgorithm;
            this[typeof(LineShape), typeof(LineSegmentShape)]  = lineAlgorithm;
            this[typeof(LineShape), typeof(TriangleShape)]     = lineAlgorithm;
            this[typeof(LineShape), typeof(RectangleShape)]    = lineAlgorithm;
            this[typeof(LineShape), typeof(BoxShape)]          = lineAlgorithm;
            this[typeof(LineShape), typeof(ConvexShape)]       = lineAlgorithm;
            this[typeof(LineShape), typeof(ScaledConvexShape)] = lineAlgorithm;
            this[typeof(LineShape), typeof(CircleShape)]       = lineAlgorithm;
            this[typeof(LineShape), typeof(SphereShape)]       = lineAlgorithm;
            this[typeof(LineShape), typeof(CapsuleShape)]      = lineAlgorithm;
            this[typeof(LineShape), typeof(ConeShape)]         = lineAlgorithm;
            this[typeof(LineShape), typeof(CylinderShape)]     = lineAlgorithm;
            this[typeof(LineShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(LineShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(LineShape), typeof(PlaneShape)]        = noAlgo;
            this[typeof(LineShape), typeof(HeightField)]       = noAlgo;
            this[typeof(LineShape), typeof(TriangleMeshShape)] = lineAlgorithm;
            this[typeof(LineShape), typeof(TransformedShape)]  = lineAlgorithm;
            this[typeof(LineShape), typeof(CompositeShape)]    = lineAlgorithm;

            this[typeof(RayShape), typeof(RayShape)]          = noAlgo;
            this[typeof(RayShape), typeof(LineSegmentShape)]  = rayConvexAlgorithm;
            this[typeof(RayShape), typeof(TriangleShape)]     = rayTriangleAlgorithm;
            this[typeof(RayShape), typeof(RectangleShape)]    = rayConvexAlgorithm;
            this[typeof(RayShape), typeof(BoxShape)]          = rayBoxAlgorithm;
            this[typeof(RayShape), typeof(ConvexShape)]       = rayConvexAlgorithm;
            this[typeof(RayShape), typeof(ScaledConvexShape)] = rayConvexAlgorithm;
            this[typeof(RayShape), typeof(CircleShape)]       = rayConvexAlgorithm;
            this[typeof(RayShape), typeof(SphereShape)]       = raySphereAlgorithm;
            this[typeof(RayShape), typeof(CapsuleShape)]      = rayConvexAlgorithm;
            this[typeof(RayShape), typeof(ConeShape)]         = rayConvexAlgorithm;
            this[typeof(RayShape), typeof(CylinderShape)]     = rayConvexAlgorithm;
            this[typeof(RayShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(RayShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(RayShape), typeof(PlaneShape)]        = planeRayAlgorithm;
            this[typeof(RayShape), typeof(HeightField)]       = rayHeightFieldAlgorithm;
            this[typeof(RayShape), typeof(TriangleMeshShape)] = rayTriangleMeshAlgorithm;
            this[typeof(RayShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(RayShape), typeof(CompositeShape)]    = rayCompositeAlgorithm;

            this[typeof(LineSegmentShape), typeof(LineSegmentShape)]  = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(TriangleShape)]     = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(RectangleShape)]    = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(BoxShape)]          = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(ConvexShape)]       = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(ScaledConvexShape)] = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(CircleShape)]       = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(SphereShape)]       = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(LineSegmentShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(LineSegmentShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(LineSegmentShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(LineSegmentShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(LineSegmentShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(LineSegmentShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(LineSegmentShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(TriangleShape), typeof(TriangleShape)]     = gjkTriTriAlgorithm;
            this[typeof(TriangleShape), typeof(RectangleShape)]    = gjkMprAlgorithm;
            this[typeof(TriangleShape), typeof(BoxShape)]          = gjkMprAlgorithm;
            this[typeof(TriangleShape), typeof(ConvexShape)]       = gjkMprAlgorithm;
            this[typeof(TriangleShape), typeof(ScaledConvexShape)] = gjkMprAlgorithm;
            this[typeof(TriangleShape), typeof(CircleShape)]       = gjkMprAlgorithm;
            this[typeof(TriangleShape), typeof(SphereShape)]       = gjkMprAlgorithm;
            this[typeof(TriangleShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(TriangleShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(TriangleShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(TriangleShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(TriangleShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(TriangleShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(TriangleShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(TriangleShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(TriangleShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(TriangleShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(RectangleShape), typeof(RectangleShape)]    = gjkMprAlgorithm;
            this[typeof(RectangleShape), typeof(BoxShape)]          = gjkMprAlgorithm;
            this[typeof(RectangleShape), typeof(ConvexShape)]       = gjkMprAlgorithm;
            this[typeof(RectangleShape), typeof(ScaledConvexShape)] = gjkMprAlgorithm;
            this[typeof(RectangleShape), typeof(CircleShape)]       = gjkMprAlgorithm;
            this[typeof(RectangleShape), typeof(SphereShape)]       = gjkMprAlgorithm;
            this[typeof(RectangleShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(RectangleShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(RectangleShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(RectangleShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(RectangleShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(RectangleShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(RectangleShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(RectangleShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(RectangleShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(RectangleShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(BoxShape), typeof(BoxShape)]          = gjkBoxAlgorithm;
            this[typeof(BoxShape), typeof(ConvexShape)]       = gjkMprAlgorithm;
            this[typeof(BoxShape), typeof(ScaledConvexShape)] = gjkMprAlgorithm;
            this[typeof(BoxShape), typeof(CircleShape)]       = gjkMprAlgorithm;
            this[typeof(BoxShape), typeof(SphereShape)]       = boxSphereAlgorithm;
            this[typeof(BoxShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(BoxShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(BoxShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(BoxShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(BoxShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(BoxShape), typeof(PlaneShape)]        = planeBoxAlgorithm;
            this[typeof(BoxShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(BoxShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(BoxShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(BoxShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(ConvexShape), typeof(ConvexShape)]       = gjkMprAlgorithm;
            this[typeof(ConvexShape), typeof(ScaledConvexShape)] = gjkMprAlgorithm;
            this[typeof(ConvexShape), typeof(CircleShape)]       = gjkMprAlgorithm;
            this[typeof(ConvexShape), typeof(SphereShape)]       = gjkMprAlgorithm;
            this[typeof(ConvexShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(ConvexShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(ConvexShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(ConvexShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(ConvexShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(ConvexShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(ConvexShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(ConvexShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(ConvexShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(ConvexShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(ScaledConvexShape), typeof(ScaledConvexShape)] = gjkMprAlgorithm;
            this[typeof(ScaledConvexShape), typeof(CircleShape)]       = gjkMprAlgorithm;
            this[typeof(ScaledConvexShape), typeof(SphereShape)]       = gjkMprAlgorithm;
            this[typeof(ScaledConvexShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(ScaledConvexShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(ScaledConvexShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(ScaledConvexShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(ScaledConvexShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(ScaledConvexShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(ScaledConvexShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(ScaledConvexShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(ScaledConvexShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(ScaledConvexShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(CircleShape), typeof(CircleShape)]       = gjkMprAlgorithm;
            this[typeof(CircleShape), typeof(SphereShape)]       = gjkMprAlgorithm;
            this[typeof(CircleShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(CircleShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(CircleShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(CircleShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(CircleShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(CircleShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(CircleShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(CircleShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(CircleShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(CircleShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(SphereShape), typeof(SphereShape)]       = sphereSphereAlgorithm;
            this[typeof(SphereShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(SphereShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(SphereShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(SphereShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(SphereShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(SphereShape), typeof(PlaneShape)]        = planeSphereAlgorithm;
            this[typeof(SphereShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(SphereShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(SphereShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(SphereShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(CapsuleShape), typeof(CapsuleShape)]      = gjkMprAlgorithm;
            this[typeof(CapsuleShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(CapsuleShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(CapsuleShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(CapsuleShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(CapsuleShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(CapsuleShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(CapsuleShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(CapsuleShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(CapsuleShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(ConeShape), typeof(ConeShape)]         = gjkMprAlgorithm;
            this[typeof(ConeShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(ConeShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(ConeShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(ConeShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(ConeShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(ConeShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(ConeShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(ConeShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(CylinderShape), typeof(CylinderShape)]     = gjkMprAlgorithm;
            this[typeof(CylinderShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(CylinderShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(CylinderShape), typeof(PlaneShape)]        = planeConvexAlgorithm;
            this[typeof(CylinderShape), typeof(HeightField)]       = heightFieldAlgorithm;
            this[typeof(CylinderShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(CylinderShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(CylinderShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(EmptyShape), typeof(EmptyShape)]        = noAlgo;
            this[typeof(EmptyShape), typeof(InfiniteShape)]     = noAlgo; // No collision between Empty and Infinite.
            this[typeof(EmptyShape), typeof(PlaneShape)]        = noAlgo;
            this[typeof(EmptyShape), typeof(HeightField)]       = noAlgo;
            this[typeof(EmptyShape), typeof(TriangleMeshShape)] = noAlgo;
            this[typeof(EmptyShape), typeof(TransformedShape)]  = noAlgo;
            this[typeof(EmptyShape), typeof(CompositeShape)]    = noAlgo;

            this[typeof(InfiniteShape), typeof(InfiniteShape)]     = infiniteAlgo;
            this[typeof(InfiniteShape), typeof(PlaneShape)]        = infiniteAlgo;
            this[typeof(InfiniteShape), typeof(HeightField)]       = infiniteAlgo;
            this[typeof(InfiniteShape), typeof(TriangleMeshShape)] = infiniteAlgo;
            this[typeof(InfiniteShape), typeof(TransformedShape)]  = infiniteAlgo;
            this[typeof(InfiniteShape), typeof(CompositeShape)]    = infiniteAlgo;

            this[typeof(PlaneShape), typeof(PlaneShape)]        = noAlgo;
            this[typeof(PlaneShape), typeof(HeightField)]       = noAlgo;
            this[typeof(PlaneShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(PlaneShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(PlaneShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(HeightField), typeof(HeightField)] = noAlgo;
            // We could also call triangleMeshAlgorithm. But since HeightField has usually larger parts it
            // is better to call the heightFieldAlgorithm. The heightFieldAlgorithm will cull all but a
            // few height field cells very quickly.
            this[typeof(HeightField), typeof(TriangleMeshShape)] = heightFieldAlgorithm;
            this[typeof(HeightField), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            // Same as for triangle meshes: Call height field algorithm first.
            this[typeof(HeightField), typeof(CompositeShape)] = heightFieldAlgorithm;

            this[typeof(TriangleMeshShape), typeof(TriangleMeshShape)] = triangleMeshAlgorithm;
            this[typeof(TriangleMeshShape), typeof(TransformedShape)]  = transformedShapeAlgorithm;
            this[typeof(TriangleMeshShape), typeof(CompositeShape)]    = compositeAlgorithm;

            this[typeof(TransformedShape), typeof(TransformedShape)] = transformedShapeAlgorithm;
            this[typeof(TransformedShape), typeof(CompositeShape)]   = transformedShapeAlgorithm;

            this[typeof(CompositeShape), typeof(CompositeShape)] = compositeAlgorithm;
        }