Formula for solving for Cx and Cy...

3k Views Asked by At

I'm trying to create a formula to find the third point in a triangle based on two known points and three known sides.

Known Sides: $AB, BC, AC$

Known Points: $A(x, y), B(x, y)$

Unknown Points: $C(x, y)$

Assumptions: $Ax = 0, Ay = 0, Bx = AB, By = 0$

Also feel free to assume a positive $Cy$ value.

The goal is:

$Cx = ?$

$Cy = ?_{(assume +)}$

I can solve this on paper but the trouble I'm having is distilling reuseable formulas from the equations that directly solve for Cx and Cy.

Thanks!

Thisis what I'm trying...

$AC = \sqrt{(Ax - Cx)^2 + (Ay - Cy)^2}$

$AC^2 = (Ax - Cx)^2 + (Ay - Cy)^2$

$AC^2 = Cx^2 + Cy^2$

$AC^2 - Cx^2 = Cy^2$


$BC = \sqrt{(Bx - Cx)^2 + (By - Cy)^2}$

$BC^2 = (Bx - Cx)^2 + (By - Cy)^2$

$BC^2 = (Bx - Cx)^2 + Cy^2$

$BC^2 - (Bx - Cx)^2 = Cy^2$

$BC^2 - (AB - Cx)^2 = Cy^2$ //substitue AB for Bx


$AC^2 - Cx^2 = $BC^2 - (AB - Cx)^2

$AC^2 - Cx^2 - ($BC^2 - (AB - Cx)^2) = 0

2

There are 2 best solutions below

1
On

You have $AC^2=(Ax-Cx)^2+(Ay+Cy)^2$ and $BC^2=(Bx-Cx)^2+(By+Cy)^2$. That is two equations in two unknowns. There will usually be two solutions-think of drawing a circle around $A$ with radius $AC$ and one around $B$ with radius $BC$.

0
On

I would still like to learn the mathematical explanation behind how this works but until some one answers, for the sake of others looking, I found a sample of a function that does the required calculation.

https://stackoverflow.com/a/12221389/949845