Instead of triangulate how to import mesh if mesh information is there?

May 18 at 10:19 AM
Edited May 18 at 11:00 AM
List<PointF> lstPoints;
        TriangleNet.Mesh mesh;
        Random random = new Random();

        TriangleNet.Geometry.InputGeometry geometry = TriangleNet.IO.FileReader.ReadNodeFile(@"C:\output\run\sam2.poly");

        // add random z values so the interpolation works
        foreach (TriangleNet.Geometry.Point vertex in geometry.Points)
            vertex.Z = 0;

       mesh = new TriangleNet.Mesh();

       mesh.Triangulate(geometry);-------instead of triangulation i need to import mesh how to do it?
Coordinator
May 18 at 11:47 AM
Edited May 18 at 3:20 PM
Use TriangleNet.Meshing.Converter.ToMesh(poly, triangles):
// Create some input mesh.
var mesh1 = GenericMesher.StructuredMesh(new Rectangle(-2.0, -2.0, 4.0, 4.0), 10, 10);

// Add some z values.
foreach (var p in mesh1.Vertices)
{
    p.Z = Math.Exp(-(p.X * p.X + p.Y * p.Y));
}

// Polygon to store the input mesh points and segments.
var poly = new Polygon();

poly.Points.AddRange(mesh1.Vertices);
poly.Segments.AddRange(mesh1.Segments);

// Construct new mesh using input mesh data.
var mesh2 = Converter.ToMesh(poly, mesh1.Triangles.ToArray());
EDIT: The above code requires beta 4. Since you are using beta 3, use the
Load(InputGeometry input, List<ITriangle> triangles)
method of the Mesh class.