From 40e15be85cfb3efe9441c9cb1b7dc7ce91f30cd5 Mon Sep 17 00:00:00 2001 From: "SND\\wo80_cp" Date: Wed, 5 Dec 2012 18:32:08 +0000 Subject: [PATCH] Fix for issue #9768 git-svn-id: https://triangle.svn.codeplex.com/svn@71203 0e2699bc-83d4-4a8f-98e7-55e24ab8c7a5 --- Triangle.NET/Triangle/NewLocation.cs | 7 +++---- Triangle.NET/Triangle/Smoothing/SimpleSmoother.cs | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Triangle.NET/Triangle/NewLocation.cs b/Triangle.NET/Triangle/NewLocation.cs index a07fc53..b2dc352 100644 --- a/Triangle.NET/Triangle/NewLocation.cs +++ b/Triangle.NET/Triangle/NewLocation.cs @@ -20,7 +20,7 @@ namespace TriangleNet /// class NewLocation { - const double EPS = 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000001; + const double EPS = 1e-50; Mesh mesh; Behavior behavior; @@ -91,7 +91,7 @@ namespace TriangleNet // keeps the type of orientation if the triangle int orientation = 0; // keeps the coordinates of circumcenter of itself and neighbor triangle circumcenter - Point myCircumcenter = default(Point), neighborCircumcenter = default(Point); + Point myCircumcenter, neighborCircumcenter; // keeps if bad triangle is almost good or not int almostGood = 0; @@ -170,8 +170,7 @@ namespace TriangleNet dy = (xdo * aodist - xao * dodist) * denominator; // for debugging and for keeping circumcenter to use later // coordinate value of the circumcenter - myCircumcenter.x = torg.x + dx; - myCircumcenter.y = torg.y + dy; + myCircumcenter = new Point(torg.x + dx, torg.y + dy); delotri = badotri; // save for later ///////////////// FINDING THE ORIENTATION OF TRIANGLE ////////////////// diff --git a/Triangle.NET/Triangle/Smoothing/SimpleSmoother.cs b/Triangle.NET/Triangle/Smoothing/SimpleSmoother.cs index 37c7138..585f33d 100644 --- a/Triangle.NET/Triangle/Smoothing/SimpleSmoother.cs +++ b/Triangle.NET/Triangle/Smoothing/SimpleSmoother.cs @@ -31,6 +31,8 @@ namespace TriangleNet.Smoothing public void Smooth() { + mesh.SetOption(Options.Quality, false); + // Take a few smoothing rounds. for (int i = 0; i < 5; i++) { @@ -39,10 +41,7 @@ namespace TriangleNet.Smoothing // Actually, we only want to rebuild, if mesh is no longer // Delaunay. Flipping edges could be the right choice instead // of re-triangulating... - var geometry = Rebuild(); - - mesh.SetOption(Options.Quality, false); - mesh.Triangulate(geometry); + mesh.Triangulate(Rebuild()); } }