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 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Bruno Luong
on 2 Nov 2018
Assuming your points are (2 x 1) vectors
d = abs(dot(Q-P,[-sin(theta);cos(theta)]))
3 Comments
madhan ravi
on 2 Nov 2018
Edited: madhan ravi
on 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.
More Answers (0)
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!