System.Drawing.Drawing2D.GraphicsPath.AppendArcs C# (CSharp) Method

AppendArcs() private method

private AppendArcs ( float x, float y, float width, float height, float startAngle, float sweepAngle ) : void
x float
y float
width float
height float
startAngle float
sweepAngle float
return void
        void AppendArcs(float x, float y, float width, float height, float startAngle, float sweepAngle)
        {
            float drawn = 0;
            int increment;
            float endAngle;
            bool enough = false;

            if (Math.Abs (sweepAngle) >= 360) {
                AddEllipse (x, y, width, height);
                return;
            }

            endAngle = startAngle + sweepAngle;
            increment = (endAngle < startAngle) ? -90 : 90;

            // i is the number of sub-arcs drawn, each sub-arc can be at most 90 degrees.
            // there can be no more then 4 subarcs, ie. 90 + 90 + 90 + (something less than 90)
            for (int i = 0; i < 4; i++) {
                float current = startAngle + drawn;
                float additional;

                if (enough)
                    return;

                additional = endAngle - current; /* otherwise, add the remainder */
                if (Math.Abs (additional) > 90) {
                    additional = increment;
                } else {
                    // a near zero value will introduce bad artefact in the drawing (Novell #78999)
                    if (NearZero (additional))
                        return;

                    enough = true;
                }

                /* only move to the starting pt in the 1st iteration */
                AppendArc ((i == 0),
                       x, y, width, height,      /* bounding rectangle */
                       current, current + additional);
                drawn += additional;
            }
        }