Add option to allow triangles being excluded from refinement.
This commit is contained in:
@@ -15,7 +15,7 @@ namespace TriangleNet.Examples
|
||||
{
|
||||
var pts = new List<Vertex>
|
||||
{
|
||||
// The 4 corners of the square.
|
||||
// The 4 corners of the rectangle.
|
||||
new Vertex(1.5, 1.0),
|
||||
new Vertex(1.5, -1.0),
|
||||
new Vertex(-1.5, -1.0),
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace TriangleNet
|
||||
bool conformDel = false;
|
||||
|
||||
Func<ITriangle, double, bool> usertest;
|
||||
Func<ITriangle, bool> exclude;
|
||||
|
||||
int noBisect = 0;
|
||||
|
||||
@@ -177,6 +178,15 @@ namespace TriangleNet
|
||||
set { usertest = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exclude triangles from being refined.
|
||||
/// </summary>
|
||||
public Func<ITriangle, bool> Exclude
|
||||
{
|
||||
get { return exclude; }
|
||||
set { exclude = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enclose the convex hull with segments.
|
||||
/// </summary>
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace TriangleNet.Meshing
|
||||
behavior.MaxAngle = quality.MaximumAngle;
|
||||
behavior.MaxArea = quality.MaximumArea;
|
||||
behavior.UserTest = quality.UserTest;
|
||||
behavior.Exclude = quality.Exclude;
|
||||
behavior.VarArea = quality.VariableArea;
|
||||
|
||||
behavior.ConformingDelaunay = behavior.ConformingDelaunay || delaunay;
|
||||
@@ -250,6 +251,11 @@ namespace TriangleNet.Meshing
|
||||
|
||||
double maxangle;
|
||||
|
||||
if (behavior.Exclude != null && behavior.Exclude(testtri.tri))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
torg = testtri.Org();
|
||||
tdest = testtri.Dest();
|
||||
tapex = testtri.Apex();
|
||||
|
||||
@@ -34,6 +34,15 @@ namespace TriangleNet.Meshing
|
||||
/// </remarks>
|
||||
public Func<ITriangle, double, bool> UserTest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a test function for excluding triangles from refinement.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The exclude test takes higher priority than all other test, i.e. if a
|
||||
/// triangle passes the exclude test, no other test will be executed.
|
||||
/// </remarks>
|
||||
public Func<ITriangle, bool> Exclude { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an area constraint per triangle.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user