フィルターのクリア

To calculate the angles of the Delaunay triangles

2 ビュー (過去 30 日間)
ZhG
ZhG 2014 年 8 月 28 日
コメント済み: ZhG 2014 年 8 月 28 日
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?

採用された回答

Roger Stafford
Roger Stafford 2014 年 8 月 28 日
編集済み: Roger Stafford 2014 年 8 月 28 日
If P1, P2, and P3 are coordinates of the three vertices of a triangle, and A is its area, its angle at P1 can be calculated as:
a1 = atan2(2*A,dot(P2-P1,P3-P1)); % <-- Corrected
and similarly for the other two angles.
  1 件のコメント
Roger Stafford
Roger Stafford 2014 年 8 月 28 日
I corrected the formula.

サインインしてコメントする。

その他の回答 (2 件)

Michael Haderlein
Michael Haderlein 2014 年 8 月 28 日
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 件のコメント
ZhG
ZhG 2014 年 8 月 28 日
This is not necessary to deal with divide operation. Thumb up.

サインインしてコメントする。


ZhG
ZhG 2014 年 8 月 28 日
Thank you guys.

カテゴリ

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