Zero Area Triangles in Delaunay Triangulation

3 次查看(过去 30 天)
Greetings,
i am using delaunayTriangulation in my Application. To be specific, i am triangulating between two Lines L1 and L2, which are a distance d apart. All Points on L1 and L2 are less or equal than d apart.
Applying the delaunayTriangulation, i ended up with multiple triangles which are on either L1 or L2. These triangles are obviously colinear, have zero area and are not very useful.
Tri = delaunayTriangulation([L1;L2]);
triplot(Tri)
hold on
Triangle1 = Tri.Points(Tri.ConnectivityList(1,:),:);
for i = 1 : 3
scatter(Triangle1(i,1),Triangle1(i,2),'filled')
end
See the attached .mats and the code snippet.
I know how the algorithm works and why this happens. Yet, my point of view, it would be desirable to include some option in the delaunayTriangulation, which allows one to prevent the creation of colinear triangles - like it is possible with the polyshape class. There might be other opinions on this, which i would be delighted to hear.
Is there some easy way of doing this with this class?
Or does anybody have an implementation of the algorithm that allows non-colinear delaunay Triangulation?
Best regards

回答(1 个)

darova
darova 2021-6-1
What about initmesh?
t = linspace(0,2*pi-0.1,20); % unclosed contour (without selfintersection)
[x1,y1] = pol2cart(t,2); % big circle
[x2,y2] = pol2cart(t,0.7); % small circle
x2 = x2 + 2; % move small circle
m1 = length(x1);
m2 = length(x2);
m = max(m1,m2);
gd = zeros(2+m*2,2); % preallocate matrix for geometry description
gd(1:(2+2*m1),1) = [2; m1; x1(:); y1(:)]; % assign data for big circle
gd(1:(2+2*m2),2) = [2; m2; x2(:); y2(:)]; % assign data for small circle
sf = 'C1-C2'; % solid formula: substract small circle from big circle
ns = char('C1','C2')'; % C1 - big circle, C2 - small circle
dl = decsg(gd,sf,ns); % decomposite solid geometry
[p,e,t] = initmesh(dl); % initialize mesh
pdemesh(p,e,t) % show mesh
more info: initmesh
preparation data: LINK

类别

Help CenterFile Exchange 中查找有关 Delaunay Triangulation 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by