how to automatically find the angle from 2 points ?
Afficher commentaires plus anciens
I try to find the angle between 2 points that I manual put it in the image but I want to find the angle between this 2 points with automatically methods. 

How to do ? Thank you.
5 commentaires
Akira Agata
le 25 Jan 2020
You mean, angle between 1) the line connecting two markers and 2) horizontal line, like the following ?

Allen
le 25 Jan 2020
What Akira is pointing out is that you cannot form an angle with two points, which only forms a single line. You need a second line to form angle (ie - a horizontal line as a reference).
A method that you can use is to capture the mouse position when clicking and after selecting two locations and then calculating the angle between the imagined line between those two points and a horizontal line. I am not able to directly help you with that step, however, the following function posted to File Exchange uses the mouse position capture capability for which you can deduce how to use from the code.
wongsathorn pinwihok
le 25 Jan 2020
wongsathorn pinwihok
le 25 Jan 2020
Adam Danz
le 26 Jan 2020
If point1 and point2 are defined by (x1,y1), (x2,y2), you can get the angle by
atan(abs(y2-y1)/abs(x2-x1)) % radians
% or
atand(abs(y2-y1)/abs(x2-x1)) % degrees
If you want to programmatically define the two points as well you'll have quite a bit more work to do starting with a solid definition of how they are located.
Réponses (0)
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!