question: public void arcTo ( double rx , double ry , double xAxisRotation , boolean largeArcFlag , boolean sweepFlag , double x , double y ) { if ( rx == 0 || ry == 0 ) { lineTo ( x , y ) ; return ; } Node lastPoint = get ( size ( ) - 1 ) ; double x0 = ( ( lastPoint . mask & C2_MASK ) == C2_MASK ) ? lastPoint . x [ 2 ] : lastPoint . x [ 0 ] ; double y0 = ( ( lastPoint . mask & C2_MASK ) == C2_MASK ) ? lastPoint . y [ 2 ] : lastPoint . y [ 0 ] ; if ( x0 == x && y0 == y ) { return ; } double dx2 = ( x0 - x ) / 2d ; double dy2 = ( y0 - y ) / 2d ; double angle = Math . toRadians ( xAxisRotation ) ; double cosAngle = Math . cos ( angle ) ; double sinAngle = Math . sin ( angle ) ; double x1 = ( cosAngle * dx2 + sinAngle * dy2 ) ; double y1 = ( - sinAngle * dx2 + cosAngle * dy2 ) ; rx = Math . abs ( rx ) ; ry = Math . abs ( ry ) ; double Prx = rx * rx ; double Pry = ry * ry ; double Px1 = x1 * x1 ; double Py1 = y1 * y1 ; double radiiCheck = Px1 / Prx + Py1 / Pry ; if ( radiiCheck > 1 ) { rx = Math . sqrt ( radiiCheck ) * rx ; ry = Math . sqrt ( radiiCheck ) * ry ; Prx = rx * rx ; Pry = ry * ry ; } double sign = ( largeArcFlag == sweepFlag ) ? - 1 : 1 ; double sq = ( ( Prx * Pry ) - ( Prx * Py1 ) - ( Pry * Px1 ) ) / ( ( Prx * Py1 ) + ( Pry * Px1 ) ) ; sq = ( sq < 0 ) ? 0 : sq ; double coef = ( sign * Math . sqrt ( sq ) ) ; double cx1 = coef * ( ( rx * y1 ) / ry ) ; double cy1 = coef * - ( ( ry * x1 ) / rx ) ; double sx2 = ( x0 + x ) / 2.0 ; double sy2 = ( y0 + y ) / 2.0 ; double cx = sx2 + ( cosAngle * cx1 - sinAngle * cy1 ) ; double cy = sy2 + ( sinAngle * cx1 + cosAngle * cy1 ) ; double ux = ( x1 - cx1 ) / rx ; double uy = ( y1 - cy1 ) / ry ; double vx = ( - x1 - cx1 ) / rx ; double vy = ( - y1 - cy1 ) / ry ; double p , n ; n = Math . sqrt ( ( ux * ux ) + ( uy * uy ) ) ; p = ux ; sign = ( uy < 0 ) ? - 1d : 1d ; double angleStart = Math . toDegrees ( sign * Math . acos ( p / n ) ) ; n = Math . sqrt ( ( ux * ux + uy * uy ) * ( vx * vx + vy * vy ) ) ; p = ux * vx + uy * vy ; sign = ( ux * vy - uy * vx < 0 ) ? - 1d : 1d ; double angleExtent = Math . toDegrees ( sign * Math . acos ( p / n ) ) ; if ( ! sweepFlag && angleExtent > 0 ) { angleExtent -= 360f ; } else if ( sweepFlag && angleExtent < 0 ) { angleExtent += 360f ; } angleExtent %= 360f ; angleStart %= 360f ; Arc2D . Double arc = new Arc2D . Double ( cx - rx , cy - ry , rx * 2d , ry * 2d , - angleStart , - angleExtent , Arc2D . OPEN ) ; PathIterator i = arc . getPathIterator ( AffineTransform . getRotateInstance ( angle , arc . getCenterX ( ) , arc . getCenterY ( ) ) ) ; double [ ] coords = new double [ 6 ] ; i . next ( ) ; while ( ! i . isDone ( ) ) { int type = i . currentSegment ( coords ) ; switch ( type ) { case PathIterator . SEG_CLOSE : break ; case PathIterator . SEG_CUBICTO : curveTo ( coords [ 0 ] , coords [ 1 ] , coords [ 2 ] , coords [ 3 ] , coords [ 4 ] , coords [ 5 ] ) ; break ; case PathIterator . SEG_LINETO : lineTo ( coords [ 0 ] , coords [ 1 ] ) ; break ; case PathIterator . SEG_MOVETO : break ; case PathIterator . SEG_QUADTO : quadTo ( coords [ 0 ] , coords [ 1 ] , coords [ 2 ] , coords [ 3 ] ) ; break ; } i . next ( ) ; } }
target:  Adds an elliptical arc, defined by two radii, an angle from the x-axis, a flag to choose the large arc or not, a flag to indicate if we increase or decrease the angles and the final point of the arc. <p> As specified in http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands <p> The implementation of this method has been derived from Apache Batik class org.apache.batik.ext.awt.geom.ExtendedGeneralPath#computArc