+// draws a an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)
+void wxGraphicsPath::AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r )
+{
+ wxPoint2DDouble current = GetCurrentPoint();
+ wxPoint2DDouble p1(x1,y1);
+ wxPoint2DDouble p2(x2,y2);
+
+ wxPoint2DDouble v1 = current - p1 ;
+ v1.Normalize();
+ wxPoint2DDouble v2 = p2 - p1 ;
+ v2.Normalize();
+
+ wxDouble alpha = v1.GetVectorAngle() - v2.GetVectorAngle();
+
+ if ( alpha < 0 )
+ alpha = 360 + alpha ;
+ // TODO obtuse angles
+
+ alpha = DegToRad(alpha);
+
+ wxDouble dist = r / sin(alpha/2) * cos(alpha/2) ;
+ // calculate tangential points
+ wxPoint2DDouble t1 = dist*v1 + p1 ;
+ wxPoint2DDouble t2 = dist*v2 + p1 ;
+
+ wxPoint2DDouble nv1 = v1 ;
+ nv1.SetVectorAngle(v1.GetVectorAngle()-90);
+ wxPoint2DDouble c = t1 + r*nv1;
+
+ wxDouble a1 = v1.GetVectorAngle()+90 ;
+ wxDouble a2 = v2.GetVectorAngle()-90 ;
+
+ AddLineToPoint(t1);
+ AddArc(c.m_x,c.m_y,r,DegToRad(a1),DegToRad(a2),true);
+ AddLineToPoint(p2);
+}
+