code: def __regpoly_coords(self, x0, y0, x1, y1, sides, start, extent):
          
  
          coords = []
          if extent == 0:
              return coords
  
          xm = (x0 + x1) / 2.
          ym = (y0 + y1) / 2.
          rx = xm - x0
          ry = ym - y0
  
          n = sides
          if n == 0: # 0 sides => circle
              n = round((rx + ry) * .5)
              if n < 2:
                  n = 4
  
          # Extent can be negative
          dirv = 1 if extent > 0 else -1
          if abs(extent) > 360:
              extent = dirv * abs(extent) % 360
  
          step = dirv * 360 / n
          numsteps = 1 + extent / float(step)
          numsteps_int = int(numsteps)
  
          i = 0
          while i < numsteps_int:
              rad = (start - i * step) * DEG2RAD
              x = rx * math.cos(rad)
              y = ry * math.sin(rad)
              coords.append((xm+x, ym-y))
              i += 1
  
          # Figure out where last segment should end
          if numsteps != numsteps_int:
              # Vecter V1 is last drawn vertext (x,y) from above
              # Vector V2 is the edge of the polygon
              rad2 = (start - numsteps_int * step) * DEG2RAD
              x2 = rx * math.cos(rad2) - x
              y2 = ry * math.sin(rad2) - y
  
              # Vector V3 is unit vector in direction we end at
              rad3 = (start - extent) * DEG2RAD
              x3 = math.cos(rad3)
              y3 = math.sin(rad3)
  
              # Find where V3 crosses V1+V2 => find j s.t.  V1 + kV2 = jV3
              j = (x*y2 - x2*y) / (x3*y2 - x2*y3)
  
              coords.append((xm + j * x3, ym - j * y3))
  
          return coords
docs: Create the coordinates of the regular polygon specified