To calculate the angles of the Delaunay triangles
Mostra commenti meno recenti
I am trying to calculate the 3 angles of each triangle generated by Delaunay triangulation. For example, I have already obtained the area and the perimeter of each triangle. But I also wanna calculate the angles of each triangle. Anyone help?
Risposta accettata
Più risposte (2)
Michael Haderlein
il 28 Ago 2014
I like that question. I'm curious if there's a faster solution (maybe even a built-in function I don't know), but my code looks like this:
x=rand(5);
y=rand(5);
TRI=delaunay(x,y);
X=x(TRI);
Y=y(TRI);
a=zeros(size(X));
for cnt=1:3
a(:,cnt)=abs(diff(angle(bsxfun(@minus,X(:,[1:cnt-1 cnt+1:end]),X(:,cnt))+1i*bsxfun(@minus,Y(:,[1:cnt-1 cnt+1:end]),Y(:,cnt))),[],2));
end
This should work but please check for testcases if it's really the case.
1 Commento
ZhG
il 28 Ago 2014
ZhG
il 28 Ago 2014
0 voti
Categorie
Scopri di più su Delaunay Triangulation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!