private void ExtractTrianglesAndOutline()
{
// Smooth the terrain bitmap
SmoothTerrain(new float[] { 1, 1, 1, 1, 1 });
//smoothTerrain(new float[]{1,1,1}); // Use this one if performance is an issue
// Extract dirt cells and outline triangles/edges from the bitmap
PerformMarchingSquares();
// Extract the outline line segments from the aforementioned edges
ExtractOutlineFromEdges();
// Combine full dirt cells and create a couple of triangles from them
ExtractTrianglesFromCells();
}