in reply to Re^2: OT:Math problem: Grids and conical sections.
in thread OT:Math problem: Grids and conical sections.

The four equations are the immediate offspring of plugging in values for x and y and z into that first equation I posted: (x-x')^2+(y-y')^2=m(z-z')^2. So for the equation for the top left corner (x'=-1, y'=1, z'=whatever height value was given), we plug those values into the above equation. Alas, I saw symmetry where there was none, and so I set m=1 which allowed much cancelling out. But even without m==1, when you multiply out the squares and then subtract any two equations, all the squares cancel out.
  • Comment on Re^3: OT:Math problem: Grids and conical sections.

Replies are listed 'Best First'.
Re^4: OT:Math problem: Grids and conical sections.
by tilly (Archbishop) on Nov 26, 2005 at 00:54 UTC
    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.

      Great job, Tilly! I just got it over here and then checked "Newest Nodes" before posting.
      You beat me to the punch!

      I'll try to transform my coordinates into yours for this post....

      <UPDATE>After all the excitement of thinking I had a different way of acheiving the solution than Tilly, it turns out it's basically the same. I'm leaving the post alive because it may be nice to have the solution to that final quadratic equation, which I include at the end.</UPDATE>

      Once getting z as you did, I plugged back into the original equation (x-x')^2+(y-y')^2=(z-z')^2/m^2 using each point for (x',y') and h1..h4 for z'. This gave me four equations (xx means x^2):

      xx-2x+1+yy =aa/mm xx+2x+1+yy =cc/mm xx +yy-2y+1=bb/mm xx +yy+2y+1=dd/mm
      I subtracted the first two to get 4*x*m*m=h3^2-h1^2.
      I subtracted the last two to get 4*y*m*m=h4^2-h2^2.
      Dividing these two values: 4*y*m*m/(4*x*m*m)=(h4^2-h2^2)/(h3^2-h1^2)
      Simplifying: y/x=(h4^2-h2^2)/(h3^2-h1^2)
      Then I plugged back into the original equation with just one point (1,0):
      Let k=y/x=(h4^2-h2^2)/(h3^2-h1^2) (from above) Let n=x*m*m=(h3^2-h1^2)/4 (from above) Original equation: (x-x')^2+(y-y')^2=(z-z')^2/m^2 (x-1 )^2+(y-0 )^2=(h1 )^2/m^2 (x-1 )^2+(xk-0)^2=(h1 )^2*x/n (x-1 )^2+(xk-0)^2=(h1 )^2*x/n multiplying it out: x^2-2x+1+x^2*k^2 =x*h1^2/n combining terms: x^2*(1+k^2)-x(2+h1^2/n)+1=0 let a=1+k^2 let b=2+h1^2/n x1=(b+sqrt(b^2-4a))/2a x2=(b-sqrt(b^2-4a))/2a y1=k*x1 y2=k*x2
      Sadly, only one of (x1,y1) or (x2,y2) is a valid solution.
        The reason that our solutions are the same is that I copied your explanation of how to do it. My attempts got lots of 4th degree polynomials and stuff which weren't simplifying.

        Nice++. Thanks for persisting even after my belief it was possible started to wane.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

      There appears to be an error in your calculations or transcription of them.

      Specifically, the sign of the 

      y2
       component of equation 1, changes between the original form
          (x-1)2 + y2 = m(z - h1)2
      ___________^
      

      and it's expansion:

          x2 - 2x + 1 - y2 = m(z2 - 2zh1 + h12)
      ________________^
      

      I don't follow the steps you used in the next stage of the reduction, (Eq.2 - Eq.1)/m, so I am unable to filter the correction through the rest of the workings.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        The error was in my transcription. That sign error was irrelevant because, no matter what I typed, I knew that the squares cancelled out.

        Your trouble following the next step was due to another typo, 4 instead of 2. The idea goes like this:

        Eqn 2 - Eqn 1:
        
          (x2 + y2 - 2y + 1)
            - (x2 - 2x + 1 + y2)
              = m(z2 - 2zh2 + h22)
                - m(z2 - 2zh1 + h12)
        
          -2y + 2x
            = m(- 2zh2 + h22 + 2zh1 - h12)
        
        Now divide both sides by m. Do the same for the other equation.