title: How to find the radius of a circle given three points in 3d space C#
body: <p>I have locations of three points along the circle. <code>pt1(x1, y1,z1)</code>, <code>pt2(x2, y2, z2)</code>, <code>pt3(x3, y3,z3)</code>. and <strong>want to find the radius of the circle. Already I have a function to compute radius in 2d space, which I am copying it here</strong></p>
  
  <pre><code>public static double ComputeRadius(Location a, Location b, Location c)
          {
              double x1 = a.x;
              double y1 = a.y;
              double x2 = b.x;
              double y2 = b.y;
              double x3 = c.x;
              double y3 = c.y;
              double mr = (double)((y2 - y1) / (x2 - x1));
              double mt = (double)((y3 - y2) / (x3 - x2));
  
              double xc = (double)((mr * mt * (y3 - y1) + mr * (x2 + x3) - mt * (x1 + x2)) / (2 * (mr - mt)));
  
              double yc = (double)((-1 / mr) * (xc - (x1 + x2) / 2) + (y1 + y2) / 2);
              double d = (xc - x1) * (xc - x1) + (yc - y1) * (yc - y1);
  
              return Math.Sqrt(d);
          }
  </code></pre>