How do I get the angle between three points input by ginput() in appdesigner?

4 ビュー (過去 30 日間)
채호 박
채호 박 2022 年 11 月 30 日
コメント済み: 채호 박 2022 年 11 月 30 日
[x, y] = ginput(3);
app.UIFigure.HandleVisibility = fhv;
x = round(x);
y = round(y);
I received the input with ginput(), but I don't know how to convert it to angle.
(R2022b)

採用された回答

David Hill
David Hill 2022 年 11 月 30 日
編集済み: David Hill 2022 年 11 月 30 日
z=[x,y];
d=diff(z);
Angle=acos(dot(-d(1,:),d(2,:))/norm(d(1,:))/norm(d(2,:)));
  1 件のコメント
채호 박
채호 박 2022 年 11 月 30 日
Thank you so much. I just have a few questions.
If I receive input from ginput(6) and the angle between the first three points is angle1, then the angle between the third points is angle2
z=[x,y];
d=diff(z);
app.angle1=acos(dot(-d(1,:),d(2,:))/norm(d(1,:))/norm(d(2,:)));
app.angle2=acos(dot(-d(4,:),d(5,:))/norm(d(4,:))/norm(d(5,:)));
Is it right?
+) If I use angle1, 'Use app.angle1 to reference app properties' appears. Is this correct?
properties (Access = private)
angle1
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by