//指定起止点及圆心作弧: 输入起止点(X1,Y1)、(X2,Y2)、参考点(X3,Y3)、圆心(X0,Y0),
//输出圆心角Angle(-360~360);若无法形成圆弧返回False, 否则返回True
function GetArcByCenter(X1, Y1, X2, Y2, X3, Y3, X0, Y0: Double; var Angle: Double): Boolean;
var
Clockwise0, Clockwise: Boolean;
begin
if (GetLineLength(X0, Y0, X1, Y1) > 0.00001)
and (GetLineLength(X0, Y0, X2, Y2) > 0.00001)
and (GetLineLength(X1, Y1, X2, Y2) > 0.00001)
and (GetLineLength(X2, Y2, X3, Y3) > 0.00001)
and (GetLineLength(X1, Y1, X3, Y3) > 0.00001) then
begin
//弧度
Angle := GetLineAngle(X0, Y0, X2, Y2) - GetLineAngle(X0, Y0, X1, Y1);
//圆心角顺时针?
Clockwise0 := IsClockwise(X1, Y1, X0, Y0, X2, Y2);
//参考点决定弧度
Clockwise := IsClockwise(X1, Y1, X3, Y3, X2, Y2);
//圆心与参考点不在起止点连线的同一侧时取小弧;反之,取大弧
if ((Clockwise0 = Clockwise) = (Abs(Angle) <= 180)) then
if Angle > 0 then
Angle := Angle - 360
else
Angle := 360 + Angle;
Result := True;
end
else
Result := False;
end;