-
-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathExample1.cs
More file actions
29 lines (24 loc) · 792 Bytes
/
Example1.cs
File metadata and controls
29 lines (24 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace TriangleNet.Examples
{
using TriangleNet.Geometry;
using TriangleNet.Meshing.Algorithm;
using TriangleNet.Rendering.Text;
/// <summary>
/// Simple point set triangulation.
/// </summary>
public class Example1 : IExample
{
public bool Run(bool print = false)
{
// Generate points.
var points = Generate.RandomPoints(50, new Rectangle(0, 0, 100, 100));
// Choose triangulator: Incremental, SweepLine or Dwyer.
var triangulator = new Dwyer();
// Generate mesh.
var mesh = triangulator.Triangulate(points, new Configuration());
if (print) SvgImage.Save(mesh, "example-1.svg", 500);
return mesh.Triangles.Count > 0;
}
}
}