PDA

View Full Version : Tangent on circle


BlackCatSLO
11-07-2007, 12:41 PM
Hy there i need equation to get distance (line d) from three points (AB line, C point). i need distance (d) from AB line to the C point as the picture shows.

shrani.si/f/H/X5/MPwoVxJ/slk.png

Tnx for help.

HallsofIvy
11-08-2007, 02:21 PM
Let the points be given, in some coordinate system, by (a1, a2, a3), (b1,b2,b3) and (c1, c2, c3) where the first two are the points on the given line. Let A= (b1-a1), B= (b2-a2), C= (b3- c3) (these are the components of a vector from (a1,a2,a3) to (b1,b2,b3)). Then the point on the line closest to (c1,c2,c3) is given by x= a1+ At, y= b1+ Bt, z= c1+ Ct where t= (a1A+a2B+a3C)/(A^2+ B^2+ C^2). The distance between that point and (c1,c2,c3) is, of course, sqrt{(x-c1)^2+ (y-c2)^2+ z-c3)^}.

If the line and point both lie in the xy-plane, then that can be done more simply as |Ac1+ Bc2|/sqrt{A^2+ B^2)}.