This project is read-only.

create triangle

Dec 9, 2013 at 9:26 AM

I would like to help me if you have patience.
I really like this library.

What I wanted to do.
I have a list of points lat, lng and h.

I would like to import this item
to make triangles
and at the end - rendering,

Is this possible?

thanks in advance
Dec 9, 2013 at 11:36 AM
Edited Dec 9, 2013 at 1:34 PM
Depending on how you'd like to render your data, you can either choose to triangulate the spherical coordinates (lat, lng), or convert to cartesian coordinates first.

In Triangle.NET, any point has two coordinates (called x, y, but this of course doesn't mean that they have to be interpreted as cartesian) and probably some attributes. To triangulate your data, first create an InputGeometry and then a Mesh:
int n = pts.Length;

var geometry = new InputGeometry(n);
for (int i = 0; i < n; i++)
    geometry.AddPoint(pts[i].lat, pts[i].lng, 0, pts[i].h);

var mesh = new Mesh();

foreach (var t in mesh.Triangles)
    int k = 0; // k = 0, 1 or 2 for the three triangle vertices
    var v = t.GetVertex(k);
    double lat =  v.X;
    double lng =  v.Y;
    double h =  v.Attributes[0];
Dec 9, 2013 at 1:09 PM
Thanks for quick replay

Its works
Dec 9, 2013 at 1:58 PM
which is a type of "base"
which class?
which object?

HexiSphereSegment.transform.parent = base.transform;

I get an error

System.Windows.Forms.Form' does not contain a definition for 'transform

i use part of code from discusion "How do I create a voronoi polygon?"

this part

UnityEngine.Mesh uMesh = new UnityEngine.Mesh();
        GameObject HexiSphereSegment = new GameObject();

        HexiSphereSegment.transform.parent = base.transform;
        HexiSphereSegment.transform.localPosition =;
        HexiSphereSegment.transform.rotation = base.transform.rotation;

        MeshFilter filter = HexiSphereSegment.AddComponent<MeshFilter>();
        HexiSphereSegment.renderer.material= base.renderer.material;
 = "Forward";
    Vector2[] _uv2D = new Vector2[voronoiVertices.Count];

    for(int x = 0; x < voronoiVertices.Count; x++){
        _uv2D[x] = new Vector2(voronoiVertices[x].x, voronoiVertices[x].y);

    uMesh.hideFlags = HideFlags.DontSave;
    uMesh.vertices = voronoiVertices.ToArray();
        uMesh.uv = _uv2D;
        uMesh.triangles =  triangles.ToArray();
        filter.mesh = uMesh;
Dec 9, 2013 at 8:19 PM
Edited Dec 9, 2013 at 11:42 PM
That's Unity3D stuff. Since I don't use Unity, I can't give you any advice here.