From: Steven on
I am using delaunayTri to generate a 2D mesh and I am trying to refine the mesh to be better behaved by splitting encroached edges. The problem is that it seems to be impossible to actually add a point to the midpoint of an edge, and instead I get a point that is very close to the midpoint. This isn't a huge problem on the interior of the mesh, since the delaunay algrorithm will avoid skinny triangles, but on the external edges it causes lots of small triangles and a never ending refinement loop. This code should illustrate the problem.

x = rand(20,1);
y = rand(20,1);
dt = DelaunayTri(x, y);
edges = dt.edges;

for i=1:size(edges, 1)
t = dt.edgeAttachments(edges(i, :));
if length(t{1}) == 1 % found an external edge
break;
end
end

mpt = (dt.X(edges(i, 1), :) + dt.X(edges(i, 2), :))/2;
dt.X(end+1, :) = mpt;

figure; hold on;
triplot(dt);
plot(dt.X(edges(i, :), 1), dt.X(edges(i, :), 2), 'r');

Is there anyway to avoid this? Some sort of precision setting for delaunayTri maybe?
From: Steven on
I guess not. It's a shame. I was really excited for this feature but without being able to split an edge successfully (or even put a bunch of points in a straight line) it ends up being pretty useless. Maybe a future release will have some more CGAL functionality, since I know CGAL itself can handle this type of thing.