Written by Ingolf Dahl, ingolf.dahl@telia.com, 2001-11-26.

Here is a routine to split a triangle, or a list of triangles, into small triangles with all sides less than d. The triangles can be 2D or 3D.

SplitTriangle[triangle_List, d_] := 
        Module[{A, B, C, a2, b2, c2}, 
          If[Depth[triangle] == 4, 
Return[
              Flatten[Table[
                  SplitTriangle[triangle[[i]], d], {i, 
                    Length[triangle]}], 1]]]; 
A = 
            triangle[[2]] - triangle[[1]]; 
B = 
            triangle[[3]] - triangle[[2]]; 
C = 
            triangle[[1]] - triangle[[3]]; 
a2 = 
            A . A; b2 = B . B; 
          c2 = C . C; 
If[
            d^2 ≥ Max[a2, b2, c2], 
            Return[{triangle}]]; 
If[
            And[a2 ≥ b2, a2 ≥ c2], 
            Return[Join[
                SplitTriangle[{triangle[[1]], triangle[[1]] + A/2, 
                    triangle[[3]]}, d], 
                SplitTriangle[{triangle[[1]] + A/2, triangle[[2]], 
                    triangle[[3]]}, d]]]]; 
If[
            And[b2 > a2, b2 ≥ c2], 
            Return[Join[
                SplitTriangle[{triangle[[1]], triangle[[2]], 
                    triangle[[2]] + B/2}, d], 
                SplitTriangle[{triangle[[1]], triangle[[2]] + B/2, 
                    triangle[[3]]}, d]]], 
            Return[Join[
                SplitTriangle[{triangle[[3]] + C/2, triangle[[2]], 
                    triangle[[3]]}, d], 
                SplitTriangle[{triangle[[1]], triangle[[2]], 
                    triangle[[3]] + C/2}, d]]]]];

Examples

SplitTriangle[{{0, 0, 0}, {0, 3, 0}, {3, 3, 0}}, 3. ]

SplitTriangle[{{{0, 0, 0}, {0, 3, 0}, {3, 3, 0}}, {{0, 0, 0}, {0, 4, 
            0}, {5, 5, 0}}}, 3. ]

Two small routines for closing and opening polygons. Closing a polygon is needed (?) if one want to draw a polygon as wireframe (with Line command) in 2D in Mathematica

ClosePolygon[polygon_List] := 
      If[polygon[[1]] ≠ 
          polygon[[Length[polygon]]], 
Append[polygon, 
          polygon[[1]]], polygon]

ClosePolygon[{{0, 0, 0}, {0, 3, 0}, {3, 3, 0}}]

OpenPolygon[polygon_List] := 
      If[polygon[[1]] == 
          polygon[[Length[polygon]]], 
Delete[polygon, 
          Length[polygon]], polygon]

OpenPolygon[{{0, 0, 0}, {0, 3, 0}, {3, 3, 0}, {0, 0, 0}}]

Martin Kraus' polygon triangulation package: I have copied a part of his help file and modified

<< PolygonTriangulation`SimplePolygonTriangulation`

Here is a list of points in the plane.

data2D = {{0. , 0. }, {-3. , 4. }, {0. , 4.5}, {0. , 3. }, {4. , 
            2. }, {0. , 1. }};

They represent a simple polygon, which is concave.

Show[Graphics[Polygon[data2D]]]

This gives the triangulation.

triang = SimplePolygonTriangulation[data2D]

This replaces the indices by the corresponding points.

triangPoints = Map[Part[data2D, #] &, triang]

This splits the triangles by my command

splitPoints = 
      SplitTriangle[triangPoints, 0.7]

The triangles cover the whole polygon. (Martin Kraus' triangulation). His triangulation is such that the left part is split into three triangles, which is good. Then no corner of any triangle will be located at the edge of another, which would cause problems sometimes.

Show[
      Graphics[Map[{Hue[Random[]], Polygon[#]} &, triangPoints]]]

The triangles as split into small parts

Show[
      Graphics[Map[{Hue[Random[]], Polygon[#]} &, splitPoints]]]

As wireframe

Show[
      Graphics[Table[
          Line[ClosePolygon[splitPoints[[i]]]], {i, 
            Length[splitPoints]}]]]