title: Calculate circle given 3 points (code explanation)
body: <p>When searching for code to calculate the circle out of 3 points it leads me to this code:</p>
  
  <pre><code>def circleRadius(b, c, d):
    temp = c[0]**2 + c[1]**2
    bc = (b[0]**2 + b[1]**2 - temp) / 2
    cd = (temp - d[0]**2 - d[1]**2) / 2
    det = (b[0] - c[0]) * (c[1] - d[1]) - (c[0] - d[0]) * (b[1] - c[1])
  
    if abs(det) &lt; 1.0e-10:
      return None
  
    # Center of circle
    cx = (bc*(c[1] - d[1]) - cd*(b[1] - c[1])) / det
    cy = ((b[0] - c[0]) * cd - (c[0] - d[0]) * bc) / det
  
    radius = ((cx - b[0])**2 + (cy - b[1])**2)**.5
  
    return radius
  </code></pre>
  
  <p>Based on <a href="https://stackoverflow.com/questions/28910718/give-3-points-and-a-plot-circle%20Stackoverflow">Stackoverflow</a> and <a href="http://mathforum.org/library/drmath/view/54323.html" rel="nofollow noreferrer">Dr.Math</a>. The code works perfectly, but I don't understand how the code fits to the explanation given at <a href="http://mathforum.org/library/drmath/view/54323.html" rel="nofollow noreferrer">Dr.Math</a>.</p>
  
  <p>Can anyone help me to understand why the code is working and what substeps are implemented in the variables?</p>