Minor changes and additions.

This commit is contained in:
wo80
2022-02-16 21:12:19 +01:00
parent b12d168cea
commit 8952d7d993
6 changed files with 76 additions and 11 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ namespace TriangleNet.Examples
using TriangleNet.Smoothing;
/// <summary>
/// Refine only a part of a polygon mesh be using region pointers and an area constraint.
/// Refine only a part of a polygon mesh by using region pointers and an area constraint.
/// </summary>
public class Example4
{
+14 -1
View File
@@ -1,8 +1,10 @@
namespace TriangleNet.Examples
{
using System;
using TriangleNet.Geometry;
using TriangleNet.Meshing;
using TriangleNet.Meshing.Iterators;
using TriangleNet.Rendering.Text;
/// <summary>
@@ -26,7 +28,18 @@ namespace TriangleNet.Examples
};
// Generate mesh using the polygons Triangulate extension method.
var mesh = poly.Triangulate(quality);
var mesh = (Mesh)poly.Triangulate(quality);
// Validate.
foreach (var e in EdgeIterator.EnumerateEdges(mesh))
{
double length = Math.Sqrt(DistSqr(e.GetVertex(0), e.GetVertex(1)));
if (length > MAX_EDGE_LENGTH)
{
Console.WriteLine("Something's wrong in here ...");
}
}
if (print) SvgImage.Save(mesh, "example-7.svg", 500);
}
+2 -2
View File
@@ -11,7 +11,7 @@ namespace TriangleNet.Examples
/// </summary>
public class Example9
{
public static void Run()
public static void Run(bool print = false)
{
var pts = new List<Vertex>
{
@@ -39,7 +39,7 @@ namespace TriangleNet.Examples
var list = MeshValidator.GetDegenerateBoundaryTriangles(mesh);
if (list.Any())
if (print && list.Any())
{
Console.WriteLine("Iteration {0}: found {1} degenerate triangle(s) of {2}.",
i, list.Count(), mesh.Triangles.Count);