[futurebasic] Re: Algebra help

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1998 : Group Archive : Group : All Groups

From: Charlie Dickman <charlied@...>
Date: Thu, 8 Oct 1998 20:39:25 -0400
>I wonder if anyone anyone can help me with this little dilemma that I must
>solve to get an image processing program to work.
>My program finds 3 points in a picture which I have the x and y coordinates
>of: Ax,Ay, Bx,By and Cx,Cy. I want to figure out where a fourth point would
>be.  I want to find the point on a line that passes through A and B that is
>closest to C. If anyone knows the method to do this the help would be greatly
>I knew I should have paid more attention in algebra class in high school.
>Thanks for any help,
>-Joe Lertola

OK, here goes...

You want the coordinates of D (Dx, Dy) which is closest to the line formed
by A and B (let's call it AB).

This point will be on AB and on the line perpendicular to AB through C (the
perpendicular distance is always the shortest).

Let M = (By-Ay)/(Bx-Ax). Then M is the slope of AB and -1/M is the slope of
CD. Finding the coordinates of D goes like this...

Dx = ((Cx+((M^2)*Ax)-(M*Ay)+(M*Cy))/((M^2)+1) and

Dy = (M*(Dx-Ax))+Ay

While there's a lot of algebra involved, the subject you missed is analytic

Charlie Dickman