Find the missing y-coordinate of a triangle point to achieve a known perimeter?

94 Views Asked by At

I'm writing a small program that generates Bezier curves from given inputs, but I've come up against a brick wall.

Given two points (A, B), an x-intersect, and a perimeter P, find both points C along the x-intersect which create a triangle ABC such that AB + BC + AC = P. For example:

P = 12
A = (0, 0)
B = (4, 3)
C = (3, ?)

I understand that AB = 5 and therefore AC + BC = 7, but can't figure out how to extract C.y from:

AC + BC = sqrt((A.x-C.x)^2 + (A.y-C.y)^2) + sqrt((B.x-C.x)^2 + (B.y-C.y)^2)
2

There are 2 best solutions below

2
On BEST ANSWER

Partial Progress :

Here is the line $AB$ , with the Potential Point $C$ on the Dashed line.

Point C must be on the Dashed line because the X-Coordinate is Constant @ 3.

ABC

When C is very high , $AC+CB$ is very large , tending to $\infty$.
When C moves downwards , $AC+CB$ is Decreasing , going through $7$ , then tending to minimum $5$ , when it is on the line $AB$.
When C more downwards , $AC+CB$ will Increase , going through $7$ , then tending to $\infty$.

Thus , there must be 2 Points where $AC+CB=7$
Let Point C have Co-ordinates $(3,Y)$.
The Equation is :
$\sqrt{(3-0)^2+(Y-0)^2}+\sqrt{(4-3)^2+(Y-3)^2}=7$
$\sqrt{9+Y^2}+\sqrt{1+(Y-3)^2}=7$
We can Square both sides , then move terms around , then Square both sides , to eliminate all Square roots. We will end up with the Polynomial Equation with maximum Degree 4. [[ thanks to user "TeM" , who showed that the terms $Y^4$ & $Y^3$ have Co-efficient $0$ , hence we get Quadratic Equation ! ]]

Wolfram gives these 2 Numerical Values :
$Y≈-0.77196$
$Y≈4.3720$

Wolfram gives these 2 Exact values :
$Y = 9/5 - (21 \sqrt{3/2})/10$
$Y = 9/5 + (21 \sqrt{3/2})/10$

This is via that Polynomial (( Quadratic , thanks to user "TeM" ! )) Equation.

0
On

Thanks to everyone for their help -- with it I was able to come up with a general solution using an ellipse-line intersect approach.

As @Moti pointed out C is on an ellipse where A and B as foci. First, imagine $A$ and $B$ translated and rotated to form a standard ellipse at the origin. The equation for an ellipse centred on the origin is:

$$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$

...where $2a$ is width of the ellipse and $2b$ is height. Since we know the length of $AB$ and the triangle perimeter $P$, we can infer $a$ using the case where transformed $C$ lies on the x-axis, and $b$ where transformed $C$ lies on the y-axis (evenly splitting the triangle):

$$ a = \frac{P - AB}{2}\\ b = \sqrt{(\frac{P-AB}{2}) ^2 - (\frac{AB}{2})^2} $$

Next, we transform the x-intersect line $L$ to the standard ellipse. The slope will be $\pi/2$ minus angle of the line ${AB}$, and $c$ is found by substituting the transformed intersect of $AB$ and the $L$. Once in slope-intercept form, we can plug it into the ellipse equation:

$$ \frac{x^2}{a^2} + \frac{(mx + c)^2}{b^2} = 1\\ \frac{b^2x^2 + a^2(mx+c)^2}{a^2b^2} = 1\\ b^2x^2 + a^2(mx+c)^2 = a^2b^2\\ (a^2m^2 + b^2)x^2 + 2a^2mcx + a^2(c^2-b^2) = 0 $$

...and then solve using the quadratic equation. Finally, we un-transform the intersect point/s to the original coordinate system.

PS: if $m$ is undefined the intersect/s can be found by rearranging the ellipse equation:

$$y = \pm b \sqrt{1 - (x/a)^2}$$