
Is it possible to assign a maximum length of an edge as constraint? I saw their are other options but not length.
I added a property to edge class which returns length. So I can iterate over edges and see which ones are longer than desired, and mark adjacent triangles are dead. Is their a way to do it?
Thanks a lot.


Coordinator
May 7, 2014 at 3:29 PM
Edited May 7, 2014 at 3:31 PM

This can be implemented with a user test function (you'll have to use the latest source code):
public void Test(InputGeometry geometry)
{
var mesh = new Mesh();
mesh.Behavior.Quality = true;
mesh.Behavior.UserTest = edgeConstraint;
mesh.Triangulate(geometry);
}
private bool edgeConstraint(ITriangle triangle, double area)
{
const double MAXLENGTH = 2.0;
var p0 = triangle.GetVertex(0);
var p1 = triangle.GetVertex(1);
var p2 = triangle.GetVertex(2);
double dx, dy;
// Check edge [P0 > P1]
dx = p0.X  p1.X;
dy = p0.Y  p1.Y;
if (Math.Sqrt(dx * dx + dy * dy) > MAXLENGTH)
{
return true;
}
// Check edge [P1 > P2]
dx = p1.X  p2.X;
dy = p1.Y  p2.Y;
if (Math.Sqrt(dx * dx + dy * dy) > MAXLENGTH)
{
return true;
}
// Check edge [P2 > P0]
dx = p2.X  p0.X;
dy = p2.Y  p0.Y;
if (Math.Sqrt(dx * dx + dy * dy) > MAXLENGTH)
{
return true;
}
return false;
}

