Skip to content Skip to sidebar Skip to footer

How To Infer The Possible Values For The Final Two Coordinates Of A Trapezoid When All 4 Line Lengths Are Known

I have a trapezoid where I know the length of all 4 lines, and I know the coordinates of two of the corners. How do I find the coordinates of the remaining two corners in JavaScrip

Solution 1:

Drop vertical lines from points C and D to the line AB to find their projections on E and F on AB:

enter image description here

Now AED and BFC are right triangles with the same height. Let's call the height h. From Pythagoras:

a² + h² = L4²     and     b² + h² = L2²

Subtracting one equation from the other you get: a² - b² = L4² - L2²

Also you can divide L1 into segments AE, EF, and FB, so the length of L1 must be:

L1 = a + L3 + b    =>    a + b = L1 - L3

Therefore we have a system of equations in a and b:

a² - b² = L4² - L2²
a + b  = L3 - L1

Using the fact that a² - b² = (a+b)(a-b) and the above equation, you get:

(L3 - L1)(a - b) = L4² - L2²   =>   a - b = (L4² - L2²)/(L3 - L1)

(Note that L1 and L3 can not be equal. If L1 = L3, there is an infinite number of solutions.)

So the equations simplify to:

a + b  = L3 - L1
a - b = (L4² - L2²)/(L3 - L1)

The solution is:

a = (L3 - L1 + (L4² - L2²)/(L3 - L1)) / 2b = (L3 - L1 - (L4² - L2²)/(L3 - L1)) / 2

The height of the trapezoid is:

h = sqrt(L4² - a²) = sqrt(L2² - b²)

You could now use a to solve for the angle at point A and b to solve the angle at point B, and use them to calculate the coordinates for C and D. Or you can use a, b, and h directly.

For example: suppose A is at the origin (0,0) and B is at (L1, 0). Then the two solutions are:

  • C is at (a, h) and D is at (L1 - b, h)
  • C is at (a, -h) and D is at (L1 - b, -h)

Post a Comment for "How To Infer The Possible Values For The Final Two Coordinates Of A Trapezoid When All 4 Line Lengths Are Known"