Delaunay Triangulation Problem

I have tried to mesh generation using the Delaunay Triangulation algorithm(1402777–72868–$Triangulator.cs (6.78 KB)).

vertex are read from a text file(1402777–72867–$vertex.txt (12.7 KB)).

However, unnecessary portions is generated.

Why do these problems occur?

1402777--72871--$ori.PNG

1402777--72872--$create.PNG

  • code -
char[] delimiterChars = { ' ', ',', ':', '\t' };
   List<Vector2> pointList = new List<Vector2> ();
   if (File.Exists ("Vertex.txt")) {
    StreamReader sr = File.OpenText ("Vertex.txt");
    string data = sr.ReadLine ();
    while (data != null) {
     print (data);
     string[] words = data.Split (delimiterChars);
     float vectorX = System.Convert.ToSingle (words [0]);
     float vectorY = System.Convert.ToSingle (words [1]);
     float vectorZ = System.Convert.ToSingle (words [2]);
      
     pointList.Add (new Vector2 (vectorX, vectorZ));
     data = sr.ReadLine ();
    }
    sr.Close ();
    Triangulator triangulator = new Triangulator ();
    GameObject obj = triangulator.CreateInfluencePolygon (pointList.ToArray ());
    obj.renderer.material = new Material(Shader.Find("Diffuse"));
    obj.transform.position = new Vector3(0,5,0);

Delaunay generates convex meshes, CTDelaunay can work with concave ones, but you need to have more than just some points for it.

Thank you for answers. What is CTDelaunay? results of googling did not find anything.

This would it be:
http://en.wikipedia.org/wiki/Constrained_Delaunay_triangulation

I think there are many other triangulation techniques, just search it :slight_smile: