I need to draw the arc from 3 points in specific direction.
Lets say i have 3 vec2 points P1, P2, P3;
I\'ve been manage to find arc center:
circ
heh was there too while convert some specific vector data elliptic arcs to SVG ...
few if should do it. I see your case like this:
try this angle correction:
if (a2-a1>+180.0) a2-=360.0;
if (a2-a1<-180.0) a2+=360.0;
if (a3-a2>+180.0) a3-=360.0;
if (a3-a2<-180.0) a3+=360.0;
and after this is direction easy:
if (a2-a1< 0) dir = CW;
if (a2-a1> 0) dir = CCW;
if (a2-a1==0) dir = none;
The only problem is when your arc cover whole 360 degree circle or more ...
draw can be done like this:
for (i=0,a=a1;i<100;i++,a+=(a3-a1)/99.0) // 100 lines per arc or use GDI arc ...
{
x=C.x + R*cos(a*PI/180.0);
y=C.y + R*sin(a*PI/180.0); // or - R*... if your render device has opposite Y direction
if (!i) ...->Canvas->MoveTo(x,y);
else ...->Canvas->LineTo(x,y);
}