BeginPackage["Arc`"] Arc::usage = "\n Arc[a,b,c] draws the arc from a to b going through c.\n The arguments should be pairs of numbers.\n" Begin["`private`"] Arc[a:{_,_},b:{_,_},c:{_,_}] := Block[{sol=NullSpace[{Append[a-b,(a.a-b.b)/2],Append[c-b,(c.c-b.b)/2]}]}, If[Length[sol]>1, Indeterminate, (* two or more points coincide *) If[sol[[1,-1]]==0, foo[a,b,c], (* points are aligned *) Block[{center=Drop[sol[[1]],-1]/-sol[[1,-1]],angles},(* generic case *) angles=fixangles[N[ArcTan@@(#-center)]& /@ {a,b,c}]; If[angles[[2]]-angles[[1]]<.000001,foo[a,b,c], Circle[center,Sqrt[len2[center-a]],angles]]]]]] len2[x_] := x.x between[a_,b_,c_] := OrderedQ[{a,b,c}] || OrderedQ[{c,b,a}] foo[a_,b_,c_] := If[between[a,b,c], Line[{a,c}], LineComplement[{a,c}]] fixangles[{a_,b_,c_}] := If[between[a,b,c], Sort[{a,c}], Sort[{a,c+2Sign[a-c]N[Pi]}]] End[] EndPackage[]