Re: [R] Draw a perpendicular line?

2010-08-25 Thread Benno Pütz
Maybe perp.slope = -1/slope abline(cy - cx*perp.slope, perp.slope) where cx, cy are x- and y-coordinate of C, resp., and slope the slope you calculated for the line through A and B Am 24.Aug.2010 um 0:04 schrieb CZ: Hi, I am trying to draw a perpendicular line from a point to two

Re: [R] Draw a perpendicular line?

2010-08-25 Thread baptiste auguie
hi, also, make sure you have set the aspect ratio to 1:1 when plotting (asp=1). HTH, baptiste On 25 August 2010 10:20, Benno Pütz pu...@mpipsykl.mpg.de wrote: Maybe perp.slope = -1/slope abline(cy - cx*perp.slope, perp.slope) where cx, cy are x- and y-coordinate of C, resp., and slope

Re: [R] Draw a perpendicular line?

2010-08-25 Thread William Revelle
At 3:04 PM -0700 8/23/10, CZ wrote: 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

Re: [R] Draw a perpendicular line?

2010-08-25 Thread Dennis Murphy
Hi: The function below plots the line segment between two points A and B as well as the normal from C to AB, with a dot as the intersection point (D), which is returned with the function call. The aspect ratio is kept at one so that the orthogonality between the two lines is not distorted by the

Re: [R] Draw a perpendicular line?

2010-08-25 Thread CZ
Thank you all for your suggestions and especially the codes. Now I am able to solve it by finding the intercepts and slopes for both lines first, and then I can find the coordinates of x and y at the intersection. At first I forgot how to use C to get the intercept of line CD... Thanks

[R] Draw a perpendicular line?

2010-08-23 Thread CZ
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