# solving for two points, having 4 defined, using linear graph as connector

I have been on it for few days now, maybe someone could tell me I am on the right track.

So i got 2 points of a linear graph:

Ax, Ay
Bx, By


And a foo number.

Also I got a statement :

foo = (Cx - Bx) / (Cy - By)


I need to find Cx, Cy

Now I have been trying to do it using linear graph equation. (y = mx + b) Knowing Ax, Ay, Bx, By, I get m and b for the linear graph.

Ending up with:

foo = (Cx - Bx) / ( (m * Cx + b) - By)


Solving for Cx, i get :

Cx = (foo * (By - b) - Bx) / (foo * s - 1)


I have been reworking this one for a while now, but the results are not as expected.

--== START of EDIT ==--

With Cx equation I got above, I get Cx = Bx, or very close to it. (I run it on Python)

Expected result: foo > Cx > Bx

--== END if EDIT ==--

I wonder if this is a correct way of doing it and if I made some mistake. If so - maybe someone could point it out for me :)

-
It looks like you're assuming $(C_x,C_y)$ is a point on the given line through the two points $(A_x,A_y)$ and $(B_x,B_y)$. If that is assumed, you can't "solve for" both $C_x$ and $C_y$. All you can do is get an equation for $C_y$ in terms of $C_x$. To do that just equate slopes. – coffeemath Feb 1 '13 at 13:54
Hey, cheers for a reply. I see your point. What could be the method to find the closest point (Cx,Cy) to the line ? – Katafalkas Feb 1 '13 at 13:59
@Katafalkas Use $C_x$ for $C_x$. Looks pretty that way. ^_^ – hjpotter92 Feb 1 '13 at 14:07
@BackinaFlash huh? :) you lost me there :) – Katafalkas Feb 1 '13 at 14:12
@Katafalkas : In your comment you ask about the closest point $(C_x,C_y)$ to the line, but isn't this point actually on the line? So this point is as close to the line as any point can be. – coffeemath Feb 1 '13 at 14:18