Finding Shortest distance from a point to a Line,which passes through a midpoint and is oriented at an angle Theta to X-Axis

7 vues (au cours des 30 derniers jours)
Hi,
I have a line,which passes through certain point "P" and is oriented at an angle "theta" degrees to X-Axis. Now,I would like to find the shortest distance from a certain point 'Q" to this line.
Thanks in Advance!

Réponse acceptée

Bruno Luong
Bruno Luong le 2 Nov 2018
Assuming your points are (2 x 1) vectors
d = abs(dot(Q-P,[-sin(theta);cos(theta)]))
  3 commentaires
madhan ravi
madhan ravi le 2 Nov 2018
Modifié(e) : madhan ravi le 2 Nov 2018
theta is supposed to be in radians, to apply the above logic right?
Yes
because sin() takes argument as radians and sind() takes degrees as argument.
Bruno Luong
Bruno Luong le 2 Nov 2018
Modifié(e) : Bruno Luong le 2 Nov 2018
I only know angle in radian. ;-)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graph and Network Algorithms dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by