This project is read-only.

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

May 18 at 11:19 AM
Edited May 18 at 12:00 PM
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?
May 18 at 12:47 PM
Edited May 18 at 4: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();


// 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.