Why does "delaunay" sometimes give a different result from "delaunayTriangulation"?

3 ビュー (過去 30 日間)
Mark Stewart
Mark Stewart 2015 年 11 月 4 日
編集済み: John D'Errico 2015 年 11 月 4 日
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);

採用された回答

John D'Errico
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 件)

カテゴリ

Help Center および File ExchangeDelaunay Triangulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by