Wow. I am impressed. This is solveable analytically!
First one note. Your equation for a cone only works if m is the slope squared. Then follow this derivation (I've marked the important equations with ****):
Point 1: (1, 0) at height h1
Eqn 1:
(x-1)2 + y2 = m(z - h1)2
x2 - 2x + 1 + y2 = m(z2 - 2zh1 + h12)
**** step 4
Point 2: (0, 1) at height h2
Eqn 2:
x2 + (y-1)2 = m(z - h2)2
x2 + y2 - 2y + 1 = m(z2 - 2zh2 + h22)
Point 3: (-1,0)) at height h3
Eqn 3:
(x+1)2 + y2 = m(z - h3)2
x2 + 2x + 1 + y2 = m(z2 - 2zh3 + h32)
Point 4: (0, -1) at height h4
Eqn 4:
x2 + (y+1)2 = m(z - h4)2
x2 + y2 + 2y + 1 = m(z2 - 2zh4 + h42)
-------------------------------------------------------
(Eqn 2 - Eqn 1)/m:
2(x - y)/m = -2zh2 + h22 + 2zh1 - h12
(Eqn 3 - Eqn 4)/m:
2(x - y)/m = -2zh3 + h32 + 2zh4 - h42
Combine to get:
-2zh2 + h22 + 2zh1 - h12 = -2zh3 + h32 + 2zh4 - h42
2z(h1 - h2 + h3 - h4) = h12 - h22 + h32 - h42
z = 0.5(h12 - h22 + h32 - h42)/(h1 - h2 + h3 - h4)
**** step 1
-------------------------------------------------------
(Eqn 3 - Eqn 1)/4:
x = 0.25m(-2zh3 + h32 + 2zh1 - h12)
**** step 2
(Eqn 4 - Eqn 2)/4:
y = 0.25m(-2zh4 + h42 + 2zh2 - h22)
**** step 3
And now we can use step 1 to find z, use steps 2 and 3 to substitute into step 4 to come up with a quadratic equation in m. Solve for m (remember that that's the slope squared). Substitute m back into steps 2 and 3 to find x and y.
Whew!
Update: Typos fixed. Had a - where I needed a +, and 4 when I needed 2. |