Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The solution that was given in the link is a "blind" solution, i.e., you know the equation, boom solve it.</p> <p>However, <strong>if you understand more deeply what is behind the scene</strong>, you will be able to:</p> <ol> <li>Write a more readable, reliable, flexible code.</li> <li>Debug easily.</li> </ol> <p>What happen when you substract equation 1 from equation 2? You actually try to find the equation of the straight line describing those points which are equidistant from the point 1 and the point 2. Then, you do the same with point 2 and 3. Finally, you find the intersection between these to lines, which gives you the center of the circle. </p> <p>How do you describe the straight line of the points equidistant to the point 1 and 2? You take the point that is in the middle of the two, and go in the direction perpendicular to the direction between point 1 and 2.</p> <p>If this is not absolutly clear, take a paper and draw an example: put points 1,2 and 3, find the two lines and find the intersection.</p> <p>Now that you understood everything, reshape your code with two functions, on that find the line equidistant between two points, another one which compute the intersection between two lines...</p> <hr> <p>After your edit, the code looked better, although it was not simple to understand. I think that the mistake is when you solve for the intersection of the two lines, do not forget that you are under parametric form:</p> <pre><code>Dx = (mid4-mid2) - m2*(mid3-mid1); lambda=Dx/D; x = mid1 + lambda*m1; y = mid2 + lambda*1.0; </code></pre> <p>Checked graphically using Matlab.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload