Java Mailing List Archive

http://www.r-help.com/

Home » R Help for Statistical Computing »

[R] Draw a perpendicular line?

CZ

2010-08-23

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi,

I am trying to draw a perpendicular line from a point to two points.
Mathematically I know how to do it, but to program it, I encounter some
problem and hope can get help. Thanks.

I have points, A, B and C. I calculate the slope and intercept for line
drawn between A and B.
I am trying to check whether I can draw a perpendicular line from C to line
AB and get the x,y value for the point D at the intersection.

Assume I get the slope of the perpendicular line, I will have my point (D)
using variable x and y which is potentially on line AB.  My idea was using
|AC|*|AC| = |AD|*|AD|+ |CD|*|CD|. I don't know what function I may need to
call to calculate the values for point D (uniroot?).

Thank you.



--
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@(protected)
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
©2008 r-help.com - Jax Systems, LLC, U.S.A.