public PointF CalculateCicular(PointF px1, PointF px2, PointF px3)
{
float x1, y1, x2, y2, x3, y3;
float a, b, c, g, e, f, X, Y;
x1 = px1.X;
y1 = px1.Y;
x2 = px2.X;
y2 = px2.Y;
x3 = px3.X;
y3 = px3.Y;
a = 2 * (x1 – x2);
b = 2 * (y1 – y2);c = 2 * (x1 - x3); d = 2 * (y1 - y3); e = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; f = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3; X = (e * d - b * f) / (a * d - b * c); Y = (e * c - a * f) / (b * c - a * d); //R = (float)Math.Sqrt((X - x1) * (X - x1) + (Y - y1) * (Y - y1)); //半径 PointF center = new PointF(X, Y); return center;
}