Draw a circle sector.

def drawSector(self, center, point, beta, fullSector=True):
        """Draw a circle sector.
        """
        center = Point(center)
        point = Point(point)
        l3 = "%g %g m\n"
        l4 = "%g %g %g %g %g %g c\n"
        l5 = "%g %g l\n"
        betar = math.radians(-beta)
        w360 = math.radians(math.copysign(360, betar)) * (-1)
        w90  = math.radians(math.copysign(90, betar))
        w45  = w90 / 2
        while abs(betar) > 2 * math.pi:
            betar += w360                       # bring angle below 360 degrees
        if not (self.lastPoint == point):
            self.draw_cont += l3 % JM_TUPLE(point * self.ipctm)
            self.lastPoint = point
        Q = Point(0, 0)                    # just make sure it exists
        C = center
        P = point
        S = P - C                               # vector 'center' -> 'point'
        rad = abs(S)                            # circle radius

        if not rad > 1e-5:
            raise ValueError("radius must be positive")

        alfa = self.horizontal_angle(center, point)
        while abs(betar) > abs(w90):            # draw 90 degree arcs
            q1 = C.x + math.cos(alfa + w90) * rad
            q2 = C.y + math.sin(alfa + w90) * rad
            Q = Point(q1, q2)              # the arc's end point
            r1 = C.x + math.cos(alfa + w45) * rad / math.cos(w45)
            r2 = C.y + math.sin(alfa + w45) * rad / math.cos(w45)
            R = Point(r1, r2)              # crossing point of tangents
            kappah = (1 - math.cos(w45)) * 4 / 3 / abs(R - Q)
            kappa = kappah * abs(P - Q)
            cp1 = P + (R - P) * kappa           # control point 1
            cp2 = Q + (R - Q) * kappa           # control point 2
            self.draw_cont += l4 % JM_TUPLE(list(cp1 * self.ipctm) + \
                                         list(cp2 * self.ipctm) + \
                                         list(Q * self.ipctm))

            betar -= w90                        # reduce parm angle by 90 deg
            alfa  += w90                        # advance start angle by 90 deg
            P = Q                               # advance to arc end point
        # draw (remaining) arc
        if abs(betar) > 1e-3:                   # significant degrees left?
            beta2 = betar / 2
            q1 = C.x + math.cos(alfa + betar) * rad
            q2 = C.y + math.sin(alfa + betar) * rad
            Q = Point(q1, q2)              # the arc's end point
            r1 = C.x + math.cos(alfa + beta2) * rad / math.cos(beta2)
            r2 = C.y + math.sin(alfa + beta2) * rad / math.cos(beta2)
            R = Point(r1, r2)              # crossing point of tangents
            # kappa height is 4/3 of segment height
            kappah = (1 - math.cos(beta2)) * 4 / 3 / abs(R - Q) # kappa height
            kappa = kappah * abs(P - Q) / (1 - math.cos(betar))
            cp1 = P + (R - P) * kappa           # control point 1
            cp2 = Q + (R - Q) * kappa           # control point 2
            self.draw_cont += l4 % JM_TUPLE(list(cp1 * self.ipctm) + \
                                         list(cp2 * self.ipctm) + \
                                         list(Q * self.ipctm))
        if fullSector:
            self.draw_cont += l3 % JM_TUPLE(point * self.ipctm)
            self.draw_cont += l5 % JM_TUPLE(center * self.ipctm)
            self.draw_cont += l5 % JM_TUPLE(Q * self.ipctm)
        self.lastPoint = Q
        return self.lastPoint