+ double dx = x1 - xc;
+ double dy = y1 - yc;
+ double radius = sqrt((double)(dx*dx+dy*dy));
+ double alpha1, alpha2;
+ if (x1 == x2 && y1 == y2)
+ {
+ alpha1 = 0.0;
+ alpha2 = 360.0;
+ }
+ else
+ if (radius == 0.0)
+ {
+ alpha1 = alpha2 = 0.0;
+ }
+ else
+ {
+ alpha1 = (x1 - xc == 0) ?
+ (y1 - yc < 0) ? 90.0 : -90.0 :
+ -atan2(double(y1-yc), double(x1-xc)) * RAD2DEG;
+ alpha2 = (x2 - xc == 0) ?
+ (y2 - yc < 0) ? 90.0 : -90.0 :
+ -atan2(double(y2-yc), double(x2-xc)) * RAD2DEG;
+
+ while (alpha1 <= 0) alpha1 += 360;
+ while (alpha2 <= 0) alpha2 += 360; // adjust angles to be between
+ while (alpha1 > 360) alpha1 -= 360; // 0 and 360 degree
+ while (alpha2 > 360) alpha2 -= 360;
+ }
+
+ if (m_brush.GetStyle() != wxTRANSPARENT)
+ {
+ SetBrush( m_brush );
+ gs_lgp->gnome_print_moveto ( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc) );
+ gs_lgp->gnome_print_arcto( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2, 0 );
+
+ gs_lgp->gnome_print_fill( m_gpc );
+ }
+
+ if (m_pen.GetStyle() != wxTRANSPARENT)
+ {
+ SetPen (m_pen);
+ gs_lgp->gnome_print_newpath( m_gpc );
+ gs_lgp->gnome_print_moveto ( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc) );
+ gs_lgp->gnome_print_arcto( m_gpc, XLOG2DEV(xc), YLOG2DEV(yc), XLOG2DEVREL((int)radius), alpha1, alpha2, 0 );
+ gs_lgp->gnome_print_closepath( m_gpc );
+
+ gs_lgp->gnome_print_stroke( m_gpc );
+ }
+
+ CalcBoundingBox (x1, y1);
+ CalcBoundingBox (x2, y2);
+ CalcBoundingBox (xc, yc);