Solving the three-dimensional equations of two units
X,y,r is unknown , X1,y1,x2,y2,x3,y3 is 3-point coordinate
(x1-x) ²-(y1-y) ²=r²
(x2-x) ²-(y2-y) ²=r²
(x3-x) ²-(y3-y) ²=r²
- (void) DrawRect: (cgrect) rect {cgpoint point1=cgpointmake ( +, +); Cgpoint Point2=cgpointmake ( +, the); Cgpoint Point3=cgpointmake ( the, -); floatA=2* (point2.x-point1.x); floatb=2* (point2.y-point1.y); floatc=point2.x*point2.x+point2.y*point2.y-point1.x*point1.x-point1.y*point1.y; floatD=2* (point3.x-point2.x); floatE=2* (point3.y-point2.y); floatf=point3.x*point3.x+point3.y*point3.y-point2.x*point2.x-point2.y*point2.y; //Center floatx= (b*f-e*c)/(b*d-e*a); floaty= (d*c-a*f)/(b*d-e*a); //radius floatR=sqrt ((x-point1.x) * (x-point1.x) + (y-point1.y) * (ypoint1.y)); Cgcontextref Context=Uigraphicsgetcurrentcontext (); [[Uicolor Redcolor]Set]; Cgcontextaddarc (context, x, Y, R,0,2*M_PI,1); Cgcontextdrawpath (context, kcgpathstroke); [[Uicolor Greencolor]Set]; Cgcontextfillrect (Context, CGRectMake (point1.x-0.5, point1.y-0.5,1,1)); Cgcontextfillrect (Context, CGRectMake (point2.x-0.5, point2.y-0.5,1,1)); Cgcontextfillrect (Context, CGRectMake (point3.x-0.5, point3.y-0.5,1,1)); Cgcontextdrawpath (context, Kcgpathstroke);}
3-point Draw Circle