More code reorganization (2)
git-svn-id: https://triangle.svn.codeplex.com/svn@75022 0e2699bc-83d4-4a8f-98e7-55e24ab8c7a5
This commit is contained in:
@@ -9,7 +9,8 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
{
|
||||
using System;
|
||||
using TriangleNet.Data;
|
||||
using TriangleNet.Log;
|
||||
using TriangleNet.Geometry;
|
||||
using TriangleNet.Logging;
|
||||
|
||||
/// <summary>
|
||||
/// Builds a delaunay triangulation using the divide-and-conquer algorithm.
|
||||
@@ -45,7 +46,8 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
class Dwyer
|
||||
{
|
||||
static Random rand = new Random(DateTime.Now.Millisecond);
|
||||
bool useDwyer = true;
|
||||
|
||||
public bool UseDwyer = true;
|
||||
|
||||
Vertex[] sortarray;
|
||||
Mesh mesh;
|
||||
@@ -314,7 +316,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
innerrightorg = innerright.Org();
|
||||
innerrightapex = innerright.Apex();
|
||||
// Special treatment for horizontal cuts.
|
||||
if (useDwyer && (axis == 1))
|
||||
if (UseDwyer && (axis == 1))
|
||||
{
|
||||
farleftpt = farleft.Org();
|
||||
farleftapex = farleft.Apex();
|
||||
@@ -363,7 +365,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
{
|
||||
changemade = false;
|
||||
// Make innerleftdest the "bottommost" vertex of the left hull.
|
||||
if (Primitives.CounterClockwise(innerleftdest, innerleftapex, innerrightorg) > 0.0)
|
||||
if (RobustPredicates.CounterClockwise(innerleftdest, innerleftapex, innerrightorg) > 0.0)
|
||||
{
|
||||
innerleft.LprevSelf();
|
||||
innerleft.SymSelf();
|
||||
@@ -372,7 +374,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
changemade = true;
|
||||
}
|
||||
// Make innerrightorg the "bottommost" vertex of the right hull.
|
||||
if (Primitives.CounterClockwise(innerrightapex, innerrightorg, innerleftdest) > 0.0)
|
||||
if (RobustPredicates.CounterClockwise(innerrightapex, innerrightorg, innerleftdest) > 0.0)
|
||||
{
|
||||
innerright.LnextSelf();
|
||||
innerright.SymSelf();
|
||||
@@ -420,8 +422,8 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
// because even though the left triangulation might seem finished now,
|
||||
// moving up on the right triangulation might reveal a new vertex of
|
||||
// the left triangulation. And vice-versa.)
|
||||
leftfinished = Primitives.CounterClockwise(upperleft, lowerleft, lowerright) <= 0.0;
|
||||
rightfinished = Primitives.CounterClockwise(upperright, lowerleft, lowerright) <= 0.0;
|
||||
leftfinished = RobustPredicates.CounterClockwise(upperleft, lowerleft, lowerright) <= 0.0;
|
||||
rightfinished = RobustPredicates.CounterClockwise(upperright, lowerleft, lowerright) <= 0.0;
|
||||
if (leftfinished && rightfinished)
|
||||
{
|
||||
// Create the top new bounding triangle.
|
||||
@@ -437,7 +439,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
nextedge.Bond(ref leftcand);
|
||||
|
||||
// Special treatment for horizontal cuts.
|
||||
if (useDwyer && (axis == 1))
|
||||
if (UseDwyer && (axis == 1))
|
||||
{
|
||||
farleftpt = farleft.Org();
|
||||
farleftapex = farleft.Apex();
|
||||
@@ -478,7 +480,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
if (nextapex != null)
|
||||
{
|
||||
// Check whether the edge is Delaunay.
|
||||
badedge = Primitives.InCircle(lowerleft, lowerright, upperleft, nextapex) > 0.0;
|
||||
badedge = RobustPredicates.InCircle(lowerleft, lowerright, upperleft, nextapex) > 0.0;
|
||||
while (badedge)
|
||||
{
|
||||
// Eliminate the edge with an edge flip. As a result, the
|
||||
@@ -508,7 +510,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
if (nextapex != null)
|
||||
{
|
||||
// Check whether the edge is Delaunay.
|
||||
badedge = Primitives.InCircle(lowerleft, lowerright, upperleft, nextapex) > 0.0;
|
||||
badedge = RobustPredicates.InCircle(lowerleft, lowerright, upperleft, nextapex) > 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -530,7 +532,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
if (nextapex != null)
|
||||
{
|
||||
// Check whether the edge is Delaunay.
|
||||
badedge = Primitives.InCircle(lowerleft, lowerright, upperright, nextapex) > 0.0;
|
||||
badedge = RobustPredicates.InCircle(lowerleft, lowerright, upperright, nextapex) > 0.0;
|
||||
while (badedge)
|
||||
{
|
||||
// Eliminate the edge with an edge flip. As a result, the
|
||||
@@ -560,7 +562,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
if (nextapex != null)
|
||||
{
|
||||
// Check whether the edge is Delaunay.
|
||||
badedge = Primitives.InCircle(lowerleft, lowerright, upperright, nextapex) > 0.0;
|
||||
badedge = RobustPredicates.InCircle(lowerleft, lowerright, upperright, nextapex) > 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -571,7 +573,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
}
|
||||
}
|
||||
if (leftfinished || (!rightfinished &&
|
||||
(Primitives.InCircle(upperleft, lowerleft, lowerright, upperright) > 0.0)))
|
||||
(RobustPredicates.InCircle(upperleft, lowerleft, lowerright, upperright) > 0.0)))
|
||||
{
|
||||
// Knit the triangulations, adding an edge from 'lowerleft'
|
||||
// to 'upperright'.
|
||||
@@ -660,7 +662,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
mesh.MakeTriangle(ref tri1);
|
||||
mesh.MakeTriangle(ref tri2);
|
||||
mesh.MakeTriangle(ref tri3);
|
||||
area = Primitives.CounterClockwise(sortarray[left], sortarray[left + 1], sortarray[left + 2]);
|
||||
area = RobustPredicates.CounterClockwise(sortarray[left], sortarray[left + 1], sortarray[left + 2]);
|
||||
if (area == 0.0)
|
||||
{
|
||||
// Three collinear vertices; the triangulation is two edges.
|
||||
@@ -858,9 +860,9 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
if ((sortarray[i].x == sortarray[j].x)
|
||||
&& (sortarray[i].y == sortarray[j].y))
|
||||
{
|
||||
if (Behavior.Verbose)
|
||||
if (Log.Verbose)
|
||||
{
|
||||
SimpleLog.Instance.Warning(
|
||||
Log.Instance.Warning(
|
||||
String.Format("A duplicate vertex appeared and was ignored (ID {0}).", sortarray[j].hash),
|
||||
"DivConquer.DivconqDelaunay()");
|
||||
}
|
||||
@@ -874,7 +876,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
}
|
||||
}
|
||||
i++;
|
||||
if (useDwyer)
|
||||
if (UseDwyer)
|
||||
{
|
||||
// Re-sort the array of vertices to accommodate alternating cuts.
|
||||
divider = i >> 1;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace TriangleNet.Meshing.Algorithm
|
||||
{
|
||||
using TriangleNet.Data;
|
||||
using TriangleNet.Log;
|
||||
using TriangleNet.Logging;
|
||||
using TriangleNet.Geometry;
|
||||
|
||||
/// <summary>
|
||||
@@ -165,9 +165,9 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
Osub tmp = default(Osub);
|
||||
if (mesh.InsertVertex(v, ref starttri, ref tmp, false, false) == InsertVertexResult.Duplicate)
|
||||
{
|
||||
if (Behavior.Verbose)
|
||||
if (Log.Verbose)
|
||||
{
|
||||
SimpleLog.Instance.Warning("A duplicate vertex appeared and was ignored.",
|
||||
Log.Instance.Warning("A duplicate vertex appeared and was ignored.",
|
||||
"Incremental.IncrementalDelaunay()");
|
||||
}
|
||||
v.type = VertexType.UndeadVertex;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
using System.Collections.Generic;
|
||||
using TriangleNet.Data;
|
||||
using TriangleNet.Geometry;
|
||||
using TriangleNet.Log;
|
||||
using TriangleNet.Logging;
|
||||
using TriangleNet.Tools;
|
||||
|
||||
/// <summary>
|
||||
@@ -381,7 +381,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
Point searchpoint = new Point(); // TODO: mesh.nextras
|
||||
Otri dummytri = default(Otri);
|
||||
|
||||
ccwabc = Primitives.CounterClockwise(pa, pb, pc);
|
||||
ccwabc = RobustPredicates.CounterClockwise(pa, pb, pc);
|
||||
xac = pa.x - pc.x;
|
||||
yac = pa.y - pc.y;
|
||||
xbc = pb.x - pc.x;
|
||||
@@ -571,7 +571,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
{
|
||||
if (heapsize == 0)
|
||||
{
|
||||
SimpleLog.Instance.Error("Input vertices are all identical.", "SweepLine.Triangulate()");
|
||||
Log.Instance.Error("Input vertices are all identical.", "SweepLine.Triangulate()");
|
||||
throw new Exception("Input vertices are all identical.");
|
||||
}
|
||||
secondvertex = eventheap[0].vertexEvent;
|
||||
@@ -580,9 +580,9 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
if ((firstvertex.x == secondvertex.x) &&
|
||||
(firstvertex.y == secondvertex.y))
|
||||
{
|
||||
if (Behavior.Verbose)
|
||||
if (Log.Verbose)
|
||||
{
|
||||
SimpleLog.Instance.Warning("A duplicate vertex appeared and was ignored (ID " + secondvertex.id + ").",
|
||||
Log.Instance.Warning("A duplicate vertex appeared and was ignored (ID " + secondvertex.id + ").",
|
||||
"SweepLine.Triangulate().1");
|
||||
}
|
||||
secondvertex.type = VertexType.UndeadVertex;
|
||||
@@ -636,9 +636,9 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
if ((nextvertex.x == lastvertex.x) &&
|
||||
(nextvertex.y == lastvertex.y))
|
||||
{
|
||||
if (Behavior.Verbose)
|
||||
if (Log.Verbose)
|
||||
{
|
||||
SimpleLog.Instance.Warning("A duplicate vertex appeared and was ignored (ID " + nextvertex.id + ").",
|
||||
Log.Instance.Warning("A duplicate vertex appeared and was ignored (ID " + nextvertex.id + ").",
|
||||
"SweepLine.Triangulate().2");
|
||||
}
|
||||
nextvertex.type = VertexType.UndeadVertex;
|
||||
@@ -700,7 +700,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
leftvertex = farlefttri.Apex();
|
||||
midvertex = lefttri.Dest();
|
||||
rightvertex = lefttri.Apex();
|
||||
lefttest = Primitives.CounterClockwise(leftvertex, midvertex, rightvertex);
|
||||
lefttest = RobustPredicates.CounterClockwise(leftvertex, midvertex, rightvertex);
|
||||
if (lefttest > 0.0)
|
||||
{
|
||||
newevent = new SweepEvent();
|
||||
@@ -715,7 +715,7 @@ namespace TriangleNet.Meshing.Algorithm
|
||||
leftvertex = righttri.Apex();
|
||||
midvertex = righttri.Org();
|
||||
rightvertex = farrighttri.Apex();
|
||||
righttest = Primitives.CounterClockwise(leftvertex, midvertex, rightvertex);
|
||||
righttest = RobustPredicates.CounterClockwise(leftvertex, midvertex, rightvertex);
|
||||
if (righttest > 0.0)
|
||||
{
|
||||
newevent = new SweepEvent();
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace TriangleNet.Meshing
|
||||
using System.Collections.Generic;
|
||||
using TriangleNet.Data;
|
||||
using TriangleNet.Geometry;
|
||||
using TriangleNet.Log;
|
||||
using TriangleNet.Logging;
|
||||
using TriangleNet.Tools;
|
||||
|
||||
internal class ConstraintMesher
|
||||
@@ -22,7 +22,7 @@ namespace TriangleNet.Meshing
|
||||
|
||||
List<Triangle> viri;
|
||||
|
||||
ILog<SimpleLogItem> logger;
|
||||
ILog<LogItem> logger;
|
||||
|
||||
public ConstraintMesher(Mesh mesh)
|
||||
{
|
||||
@@ -32,7 +32,7 @@ namespace TriangleNet.Meshing
|
||||
|
||||
this.viri = new List<Triangle>();
|
||||
|
||||
logger = SimpleLog.Instance;
|
||||
logger = Log.Instance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -72,7 +72,7 @@ namespace TriangleNet.Meshing
|
||||
// falls within the starting triangle.
|
||||
searchorg = searchtri.Org();
|
||||
searchdest = searchtri.Dest();
|
||||
if (Primitives.CounterClockwise(searchorg, searchdest, hole) > 0.0)
|
||||
if (RobustPredicates.CounterClockwise(searchorg, searchdest, hole) > 0.0)
|
||||
{
|
||||
// Find a triangle that contains the hole.
|
||||
intersect = mesh.locator.Locate(hole, ref searchtri);
|
||||
@@ -114,7 +114,7 @@ namespace TriangleNet.Meshing
|
||||
// region point falls within the starting triangle.
|
||||
searchorg = searchtri.Org();
|
||||
searchdest = searchtri.Dest();
|
||||
if (Primitives.CounterClockwise(searchorg, searchdest, region.point) > 0.0)
|
||||
if (RobustPredicates.CounterClockwise(searchorg, searchdest, region.point) > 0.0)
|
||||
{
|
||||
// Find a triangle that contains the region point.
|
||||
intersect = mesh.locator.Locate(region.point, ref searchtri);
|
||||
@@ -202,14 +202,14 @@ namespace TriangleNet.Meshing
|
||||
|
||||
if ((end1 < 0) || (end1 >= mesh.invertices))
|
||||
{
|
||||
if (Behavior.Verbose)
|
||||
if (Log.Verbose)
|
||||
{
|
||||
logger.Warning("Invalid first endpoint of segment.", "Mesh.FormSkeleton().1");
|
||||
}
|
||||
}
|
||||
else if ((end2 < 0) || (end2 >= mesh.invertices))
|
||||
{
|
||||
if (Behavior.Verbose)
|
||||
if (Log.Verbose)
|
||||
{
|
||||
logger.Warning("Invalid second endpoint of segment.", "Mesh.FormSkeleton().2");
|
||||
}
|
||||
@@ -224,7 +224,7 @@ namespace TriangleNet.Meshing
|
||||
endpoint2 = mesh.vertices[end2];
|
||||
if ((endpoint1.x == endpoint2.x) && (endpoint1.y == endpoint2.y))
|
||||
{
|
||||
if (Behavior.Verbose)
|
||||
if (Log.Verbose)
|
||||
{
|
||||
logger.Warning("Endpoints of segment (IDs " + end1 + "/" + end2 + ") are coincident.",
|
||||
"Mesh.FormSkeleton()");
|
||||
@@ -544,10 +544,10 @@ namespace TriangleNet.Meshing
|
||||
rightvertex = searchtri.Dest();
|
||||
leftvertex = searchtri.Apex();
|
||||
// Is 'searchpoint' to the left?
|
||||
leftccw = Primitives.CounterClockwise(searchpoint, startvertex, leftvertex);
|
||||
leftccw = RobustPredicates.CounterClockwise(searchpoint, startvertex, leftvertex);
|
||||
leftflag = leftccw > 0.0;
|
||||
// Is 'searchpoint' to the right?
|
||||
rightccw = Primitives.CounterClockwise(startvertex, searchpoint, rightvertex);
|
||||
rightccw = RobustPredicates.CounterClockwise(startvertex, searchpoint, rightvertex);
|
||||
rightflag = rightccw > 0.0;
|
||||
if (leftflag && rightflag)
|
||||
{
|
||||
@@ -574,7 +574,7 @@ namespace TriangleNet.Meshing
|
||||
}
|
||||
leftvertex = searchtri.Apex();
|
||||
rightccw = leftccw;
|
||||
leftccw = Primitives.CounterClockwise(searchpoint, startvertex, leftvertex);
|
||||
leftccw = RobustPredicates.CounterClockwise(searchpoint, startvertex, leftvertex);
|
||||
leftflag = leftccw > 0.0;
|
||||
}
|
||||
while (rightflag)
|
||||
@@ -588,7 +588,7 @@ namespace TriangleNet.Meshing
|
||||
}
|
||||
rightvertex = searchtri.Dest();
|
||||
leftccw = rightccw;
|
||||
rightccw = Primitives.CounterClockwise(startvertex, searchpoint, rightvertex);
|
||||
rightccw = RobustPredicates.CounterClockwise(startvertex, searchpoint, rightvertex);
|
||||
rightflag = rightccw > 0.0;
|
||||
}
|
||||
if (leftccw == 0.0)
|
||||
@@ -867,7 +867,7 @@ namespace TriangleNet.Meshing
|
||||
// Check whether the previous polygon vertex is a reflex vertex.
|
||||
if (leftside)
|
||||
{
|
||||
if (Primitives.CounterClockwise(nearvertex, leftvertex, farvertex) <= 0.0)
|
||||
if (RobustPredicates.CounterClockwise(nearvertex, leftvertex, farvertex) <= 0.0)
|
||||
{
|
||||
// leftvertex is a reflex vertex too. Nothing can
|
||||
// be done until a convex section is found.
|
||||
@@ -876,20 +876,20 @@ namespace TriangleNet.Meshing
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Primitives.CounterClockwise(farvertex, rightvertex, nearvertex) <= 0.0)
|
||||
if (RobustPredicates.CounterClockwise(farvertex, rightvertex, nearvertex) <= 0.0)
|
||||
{
|
||||
// rightvertex is a reflex vertex too. Nothing can
|
||||
// be done until a convex section is found.
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Primitives.CounterClockwise(rightvertex, leftvertex, farvertex) > 0.0)
|
||||
if (RobustPredicates.CounterClockwise(rightvertex, leftvertex, farvertex) > 0.0)
|
||||
{
|
||||
// fartri is not an inverted triangle, and farvertex is not a reflex
|
||||
// vertex. As there are no reflex vertices, fixuptri isn't an
|
||||
// inverted triangle, either. Hence, test the edge between the
|
||||
// triangles to ensure it is locally Delaunay.
|
||||
if (Primitives.InCircle(leftvertex, farvertex, rightvertex, nearvertex) <= 0.0)
|
||||
if (RobustPredicates.InCircle(leftvertex, farvertex, rightvertex, nearvertex) <= 0.0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -991,7 +991,7 @@ namespace TriangleNet.Meshing
|
||||
{
|
||||
// Check whether farvertex is to the left or right of the segment being
|
||||
// inserted, to decide which edge of fixuptri to dig through next.
|
||||
area = Primitives.CounterClockwise(endpoint1, endpoint2, farvertex);
|
||||
area = RobustPredicates.CounterClockwise(endpoint1, endpoint2, farvertex);
|
||||
if (area == 0.0)
|
||||
{
|
||||
// We've collided with a vertex between endpoint1 and endpoint2.
|
||||
|
||||
@@ -26,6 +26,16 @@ namespace TriangleNet.Meshing
|
||||
/// </summary>
|
||||
public bool Convex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Suppresses boundary segment splitting.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 0 = split segments (default)
|
||||
/// 1 = no new vertices on the boundary
|
||||
/// 2 = prevent all segment splitting, including internal boundaries
|
||||
/// </remarks>
|
||||
public int SegmentSplitting { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace TriangleNet.Meshing
|
||||
using System.Linq;
|
||||
using TriangleNet.Data;
|
||||
using TriangleNet.Geometry;
|
||||
using TriangleNet.Log;
|
||||
using TriangleNet.Logging;
|
||||
|
||||
/// <summary>
|
||||
/// The DataReader class provides methods for mesh reconstruction.
|
||||
@@ -140,7 +140,7 @@ namespace TriangleNet.Meshing
|
||||
{
|
||||
if ((corner[j] < 0) || (corner[j] >= mesh.invertices))
|
||||
{
|
||||
SimpleLog.Instance.Error("Triangle has an invalid vertex index.", "MeshReader.Reconstruct()");
|
||||
Log.Instance.Error("Triangle has an invalid vertex index.", "MeshReader.Reconstruct()");
|
||||
throw new Exception("Triangle has an invalid vertex index.");
|
||||
}
|
||||
}
|
||||
@@ -250,7 +250,7 @@ namespace TriangleNet.Meshing
|
||||
{
|
||||
if ((end[j] < 0) || (end[j] >= mesh.invertices))
|
||||
{
|
||||
SimpleLog.Instance.Error("Segment has an invalid vertex index.", "MeshReader.Reconstruct()");
|
||||
Log.Instance.Error("Segment has an invalid vertex index.", "MeshReader.Reconstruct()");
|
||||
throw new Exception("Segment has an invalid vertex index.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,16 +6,14 @@
|
||||
|
||||
namespace TriangleNet.Meshing
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TriangleNet.Geometry;
|
||||
|
||||
/// <summary>
|
||||
/// TODO: Update summary.
|
||||
/// </summary>
|
||||
public interface ITriangulator
|
||||
{
|
||||
int Triangulate(Mesh mesh);
|
||||
Mesh Triangulate(ICollection<Vertex> points);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// <copyright file="Quality.cs">
|
||||
// <copyright file="QualityMesher.cs">
|
||||
// Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html
|
||||
// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
|
||||
// </copyright>
|
||||
@@ -10,8 +10,8 @@ namespace TriangleNet.Meshing
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TriangleNet.Data;
|
||||
using TriangleNet.Log;
|
||||
using TriangleNet.Geometry;
|
||||
using TriangleNet.Logging;
|
||||
|
||||
/// <summary>
|
||||
/// Provides methods for mesh quality enforcement and testing.
|
||||
@@ -25,11 +25,11 @@ namespace TriangleNet.Meshing
|
||||
|
||||
NewLocation newLocation;
|
||||
|
||||
ILog<SimpleLogItem> logger;
|
||||
ILog<LogItem> logger;
|
||||
|
||||
public QualityMesher(Mesh mesh)
|
||||
{
|
||||
logger = SimpleLog.Instance;
|
||||
logger = Log.Instance;
|
||||
|
||||
badsubsegs = new Queue<BadSubseg>();
|
||||
queue = new BadTriQueue();
|
||||
@@ -150,15 +150,15 @@ namespace TriangleNet.Meshing
|
||||
encroachedseg = new BadSubseg();
|
||||
if (encroached == 1)
|
||||
{
|
||||
encroachedseg.encsubseg = testsubseg;
|
||||
encroachedseg.subsegorg = eorg;
|
||||
encroachedseg.subsegdest = edest;
|
||||
encroachedseg.subseg = testsubseg;
|
||||
encroachedseg.org = eorg;
|
||||
encroachedseg.dest = edest;
|
||||
}
|
||||
else
|
||||
{
|
||||
encroachedseg.encsubseg = testsym;
|
||||
encroachedseg.subsegorg = edest;
|
||||
encroachedseg.subsegdest = eorg;
|
||||
encroachedseg.subseg = testsym;
|
||||
encroachedseg.org = edest;
|
||||
encroachedseg.dest = eorg;
|
||||
}
|
||||
|
||||
badsubsegs.Enqueue(encroachedseg);
|
||||
@@ -430,14 +430,14 @@ namespace TriangleNet.Meshing
|
||||
|
||||
seg = badsubsegs.Dequeue();
|
||||
|
||||
currentenc = seg.encsubseg;
|
||||
currentenc = seg.subseg;
|
||||
eorg = currentenc.Org();
|
||||
edest = currentenc.Dest();
|
||||
// Make sure that this segment is still the same segment it was
|
||||
// when it was determined to be encroached. If the segment was
|
||||
// enqueued multiple times (because several newly inserted
|
||||
// vertices encroached it), it may have already been split.
|
||||
if (!Osub.IsDead(currentenc.seg) && (eorg == seg.subsegorg) && (edest == seg.subsegdest))
|
||||
if (!Osub.IsDead(currentenc.seg) && (eorg == seg.org) && (edest == seg.dest))
|
||||
{
|
||||
// To decide where to split a segment, we need to know if the
|
||||
// segment shares an endpoint with an adjacent segment.
|
||||
@@ -569,7 +569,7 @@ namespace TriangleNet.Meshing
|
||||
// Roundoff in the above calculation may yield a 'newvertex'
|
||||
// that is not precisely collinear with 'eorg' and 'edest'.
|
||||
// Improve collinearity by one step of iterative refinement.
|
||||
multiplier = Primitives.CounterClockwise(eorg, edest, newvertex);
|
||||
multiplier = RobustPredicates.CounterClockwise(eorg, edest, newvertex);
|
||||
divisor = ((eorg.x - edest.x) * (eorg.x - edest.x) +
|
||||
(eorg.y - edest.y) * (eorg.y - edest.y));
|
||||
if ((multiplier != 0.0) && (divisor != 0.0))
|
||||
@@ -615,7 +615,7 @@ namespace TriangleNet.Meshing
|
||||
|
||||
// Set subsegment's origin to NULL. This makes it possible to detect dead
|
||||
// badsubsegs when traversing the list of all badsubsegs.
|
||||
seg.subsegorg = null;
|
||||
seg.org = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,8 +658,8 @@ namespace TriangleNet.Meshing
|
||||
// Make sure that this triangle is still the same triangle it was
|
||||
// when it was tested and determined to be of bad quality.
|
||||
// Subsequent transformations may have made it a different triangle.
|
||||
if (!Otri.IsDead(badotri.triangle) && (borg == badtri.triangorg) &&
|
||||
(bdest == badtri.triangdest) && (bapex == badtri.triangapex))
|
||||
if (!Otri.IsDead(badotri.triangle) && (borg == badtri.org) &&
|
||||
(bdest == badtri.dest) && (bapex == badtri.apex))
|
||||
{
|
||||
errorflag = false;
|
||||
// Create a new vertex at the triangle's circumcenter.
|
||||
@@ -670,7 +670,7 @@ namespace TriangleNet.Meshing
|
||||
// reset VertexType?
|
||||
if (behavior.fixedArea || behavior.VarArea)
|
||||
{
|
||||
newloc = Primitives.FindCircumcenter(borg, bdest, bapex, ref xi, ref eta, behavior.offconstant);
|
||||
newloc = RobustPredicates.FindCircumcenter(borg, bdest, bapex, ref xi, ref eta, behavior.offconstant);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -682,7 +682,7 @@ namespace TriangleNet.Meshing
|
||||
((newloc.x == bdest.x) && (newloc.y == bdest.y)) ||
|
||||
((newloc.x == bapex.x) && (newloc.y == bapex.y)))
|
||||
{
|
||||
if (Behavior.Verbose)
|
||||
if (Log.Verbose)
|
||||
{
|
||||
logger.Warning("New vertex falls on existing vertex.", "Quality.SplitTriangle()");
|
||||
errorflag = true;
|
||||
@@ -746,7 +746,7 @@ namespace TriangleNet.Meshing
|
||||
else
|
||||
{ // success == DUPLICATEVERTEX
|
||||
// Couldn't insert the new vertex because a vertex is already there.
|
||||
if (Behavior.Verbose)
|
||||
if (Log.Verbose)
|
||||
{
|
||||
logger.Warning("New vertex falls on existing vertex.", "Quality.SplitTriangle()");
|
||||
errorflag = true;
|
||||
@@ -811,7 +811,7 @@ namespace TriangleNet.Meshing
|
||||
// and have no low-quality triangles.
|
||||
|
||||
// Might we have run out of Steiner points too soon?
|
||||
if (Behavior.Verbose && behavior.ConformingDelaunay && (badsubsegs.Count > 0) && (mesh.steinerleft == 0))
|
||||
if (Log.Verbose && behavior.ConformingDelaunay && (badsubsegs.Count > 0) && (mesh.steinerleft == 0))
|
||||
{
|
||||
|
||||
logger.Warning("I ran out of Steiner points, but the mesh has encroached subsegments, "
|
||||
|
||||
Reference in New Issue
Block a user