Why does "delaunay" sometimes give a different result from "delaunayTriangulation"?
3 次查看(过去 30 天)
显示 更早的评论
I have a file containing a set of x,y,z points which describe the surface of a 10 pence coin. I wish to triangulate the data. I tried Matlab's in-built "delaunay" function and the results are satisfactory. However, if I use Matlab's in-built "delaunayTriangulation" function I get a completely different result. Can you suggest possible reasons for this difference? For visualisation of the problem I have included the script below and I have also attached a .csv file containing a sample of the x,y,z data:
Thanks
fname = 'ten_pence_coin_sample.csv';
data = csvread(fname);
deltaX = 20;
TopThreshold = 37000;
BotThreshold = 8620;
XXXX = 0;
PrevEnc = 0;
x = zeros(length(data(:,1)),1);
for n = 1: length(data(:,1))
if n>1
PrevEnc = data(n-1, 4);
end
Enc = data(n,4);
if Enc>TopThreshold && PrevEnc < TopThreshold
XXXX = XXXX + deltaX;
x(n) = nan;
elseif Enc<BotThreshold && PrevEnc > BotThreshold
XXXX = XXXX + deltaX;
x(n) = nan;
else
x(n) = XXXX;
end
end
z=data(:,2);
z(find(z<0)) = nan;
filt_ind = isnan(z) | isnan(x) ;
z_filt = z ;
x_filt = x ;
y_filt = data(:,4) - min(data(:,4)) ;
z_filt(filt_ind) = [];
x_filt(filt_ind) = [];
y_filt(filt_ind) = [];
DT = delaunay(x_filt,y_filt);
DT2 = delaunayTriangulation(x_filt,y_filt);
figure
trimesh(DT,x_filt,y_filt,z_filt);
figure
trimesh(DT2.ConnectivityList,x_filt,y_filt,z_filt);
0 个评论
采纳的回答
John D'Errico
2015-11-4
编辑:John D'Errico
2015-11-4
What is the delaunay triangulation of the unit square? Thus, if we start with the vertices
V = [0 0;0 1;1 0;1 1];
Is there a unique triangulation? I think the answer is clear. There is no unique choice that is better. We might have the pair or triangles
tri1 = [1 2 3;2 3 4]
or we might choose the pair
tri2 = [1 2 4;1 3 4];
Either is as good a choice. Effectively, the difference is only in the diagonal of the square we choose. Two different algorithms might make different choices, and be equally correct in their choice.
In addition, some algorithms resolve issues by making a joggle of the points, a pseudo-random perturbation of points, which can greatly help. However, there you will even find the same algorithm produces non-identical results upon repeated applications.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Delaunay Triangulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!