public void Explode()
 {
     if (children != null)
     {
         foreach (EquilateralTriangle tri in children)
             tri.Explode();
     }
     else
     {
         children = new EquilateralTriangle[4];
         Vector2 halfLeft = (corners[0]+corners[1])/2.0f;
         Vector2 halfRight = (corners[1]+corners[2])/2.0f;
         Vector2 halfBase = (corners[0]+corners[2])/2.0f;
         children[0] = new EquilateralTriangle(corners[0], halfLeft, halfBase);
         children[1] = new EquilateralTriangle(halfLeft, corners[1], halfRight);
         children[2] = new EquilateralTriangle(halfBase, halfRight, corners[2]);
         children[3] = new EquilateralTriangle(halfLeft, halfRight, halfBase);
     }
 }
        public void TestTriangle()
        {
            tri = new EquilateralTriangle();
            engine.InitializationComplete += (o, e) =>
            {
                engine.BindMesh(tri, "ExTerrain");
                FetchHiresTerrain();
                FetchLoresTerrain();
            };
            engine.PreRendering += (o, e) =>
            {
                if (engine.CameraInput.Input.IsKeyPressed(Keys.X))
                {
                    tri.Explode();
                    tri.Recreate();
                }
            MoveMesh(tri);
            };

            Application.Run(form);
        }