How to Draw a Arc with AngelArc Function in GDI? if we just have two Node points of the Arc and the Arc Radius?
We can calculate the Arc Center with Math formula directly~ but it seems too complicate for some of us(sepecially for me, I almost take several hours to work out the center point axis). check the code below would be good for us to do so, and give my thanks to whoever help me in the internet.:
static bool calCenterPoint(double x1, double y1, double x2, double y2, double x3, double y3, double r, double* xC, double* yC) { //POINT (x3,y3) is the control point to get the correct point. double dx = 0.5*(y1-y2); double dy = 0.5*(x2-x1); double R = dx*dx+dy*dy; double x[2]; double y[2]; if( R<0.0000001 || r*r<R ) return false; r = sqrt(r*r-R)/sqrt(R); dx *= r; dy *= r; x[0] = 0.5*(x1+x2)+dx; y[0] = 0.5*(y1+y2)+dy; x[1] = 0.5*(x1+x2)-dx; y[1] = 0.5*(y1+y2)-dy;