'Return an arc on the unit circle from angle
*theta1* to angle *theta2* (in degrees).
*theta2* is unwrapped to produce the shortest arc within 360 degrees.
That is, if *theta2* > *theta1* + 360, the arc will be from *theta1* to
*theta2* - 360 and not a full circle plus some extra overlap.
If *n* is provided, it is the number of spline segments to make.
If *n* is not provided, the number of spline segments is
determined based on the delta between *theta1* and *theta2*.
Masionobe, L.  2003.  `Drawing an elliptical arc using
polylines, quadratic or cubic Bezier curves
<http://www.spaceroots.org/documents/ellipse/index.html>`_.'

@classmethod
def arc(cls, theta1, theta2, n=None, is_wedge=False):

    halfpi = (np.pi * 0.5)
    eta1 = theta1
    eta2 = (theta2 - (360 * np.floor(((theta2 - theta1) / 360))))
    if ((theta2 != theta1) and (eta2 <= eta1)):
        eta2 += 360
    (eta1, eta2) = np.deg2rad([eta1, eta2])
    if (n is None):
        n = int((2 ** np.ceil(((eta2 - eta1) / halfpi))))
    if (n < 1):
        raise ValueError(u'n    must    be    >=    1    or    None')
    deta = ((eta2 - eta1) / n)
    t = np.tan((0.5 * deta))
    alpha = ((np.sin(deta) * (np.sqrt((4.0 + ((3.0 * t) * t))) - 1)) / 3.0)
    steps = np.linspace(eta1, eta2, (n + 1), True)
    cos_eta = np.cos(steps)
    sin_eta = np.sin(steps)
    xA = cos_eta[:(-1)]
    yA = sin_eta[:(-1)]
    xA_dot = (- yA)
    yA_dot = xA
    xB = cos_eta[1:]
    yB = sin_eta[1:]
    xB_dot = (- yB)
    yB_dot = xB
    if is_wedge:
        length = ((n * 3) + 4)
        vertices = np.zeros((length, 2), float)
        codes = (cls.CURVE4 * np.ones((length,), cls.code_type))
        vertices[1] = [xA[0], yA[0]]
        codes[0:2] = [cls.MOVETO, cls.LINETO]
        codes[(-2):] = [cls.LINETO, cls.CLOSEPOLY]
        vertex_offset = 2
        end = (length - 2)
    else:
        length = ((n * 3) + 1)
        vertices = np.empty((length, 2), float)
        codes = (cls.CURVE4 * np.ones((length,), cls.code_type))
        vertices[0] = [xA[0], yA[0]]
        codes[0] = cls.MOVETO
        vertex_offset = 1
        end = length
    vertices[vertex_offset:end:3, 0] = (xA + (alpha * xA_dot))
    vertices[vertex_offset:end:3, 1] = (yA + (alpha * yA_dot))
    vertices[(vertex_offset + 1):end:3, 0] = (xB - (alpha * xB_dot))
    vertices[(vertex_offset + 1):end:3, 1] = (yB - (alpha * yB_dot))
    vertices[(vertex_offset + 2):end:3, 0] = xB
    vertices[(vertex_offset + 2):end:3, 1] = yB
    return cls(vertices, codes, readonly=True)
