三点计算圆心和半径
double[] y = { 199.5, 286.5, 310.5 };
double u = (y[1] - y[0]) / (x[1] - x[0]);
double v = (y[2] - y[1]) / (x[2] - x[1]);
double w = 0.5 * (y[0] + y[1]) + 0.5 * (x[0] + x[1]) / ((y[1] - y[0]) / (x[1] - x[0]));
double k = 0.5 * (y[1] + y[2]) + 0.5 * (x[1] + x[2]) / ((y[2] - y[1]) / (x[2] - x[1]));
double cy = (w - k) / u / (1 / v - 1 / u) + w;
double r = Math.Sqrt(Math.Pow((y[0] - cy), 2) + Math.Pow((x[0] - cx), 2));
Console.WriteLine("x {0}, y {1}, r {2}",cx,cy,r);
Console.ReadKey();
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:三点计算圆心和半径 – 原随云 - Python技术站