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()); } }