Draw a circle of 'radius' centered at (x, y)
171171
def circle(self, clear_screen=True, x=50, y=50, radius=40, fill_color='black', outline_color='black'):
        

        if clear_screen:
            self.clear()

        x1 = x - radius
        y1 = y - radius
        x2 = x + radius
        y2 = y + radius

        return self.draw.ellipse((x1, y1, x2, y2), fill=fill_color, outline=outline_color)
1086019
def circle(m, centerlon, centerlat, radius, *args, **kwargs):
    
    glon1 = centerlon
    glat1 = centerlat
    X = []
    Y = []
    for azimuth in range(0, 360):
        glon2, glat2, baz = _gccalc(glon1, glat1, azimuth, radius)
        X.append(glon2)
        Y.append(glat2)
    X.append(X[0])
    Y.append(Y[0])

    proj_x, proj_y = m(X,Y)
    return zip(proj_x, proj_y)
187201
def quarter_circle(center, options)
      case options[:quadrant]
      when 1
        start_angle = 0
        end_angle = 90
      when 2
        start_angle = 90
        end_angle = 180
      when 3
        start_angle = 180
        end_angle = 270
      when 4
        start_angle = 270
        end_angle = 360
      end
      pie_slice(center,
                :radius => options[:radius],
                :start_angle => start_angle,
                :end_angle => end_angle,
                :stroke_both_sides => options[:stroke_both_sides])
    end
1125821
def drawCircle(page, center, radius, color=None, fill=None,
               morph=None, dashes=None, width=1,
               roundCap=False, overlay=True):
    
    img = page.newShape()
    Q = img.drawCircle(Point(center), radius)
    img.finish(color=color, fill=fill, dashes=dashes, width=width,
               roundCap=roundCap, morph=morph)
    img.commit(overlay)
    return Q
788637
function Circle2D( x , y , r ) {
	this.center = new Vector2D( x , y ) ;
	this.r = + r ;
}
195467
def round_corner(radius, fill):
    """"""
    corner = Image.new('L', (radius, radius), 0)  # (0, 0, 0, 0))
    draw = ImageDraw.Draw(corner)
    draw.pieslice((0, 0, radius * 2, radius * 2), 180, 270, fill=fill)
    return corner
909020
def draw_arc(self, color, world_loc, world_radius, start_angle, stop_angle,
               thickness=1):
    """"""
    center = self.world_to_surf.fwd_pt(world_loc).round()
    radius = max(1, int(self.world_to_surf.fwd_dist(world_radius)))
    rect = pygame.Rect(center - radius, (radius * 2, radius * 2))
    pygame.draw.arc(self.surf, color, rect, start_angle, stop_angle,
                    thickness if thickness < radius else 0)
1360446
def point_in_circle(pt, center, radius):
    '''
    
    '''
    d = np.linalg.norm(np.asarray(pt) - np.asarray(center))
    return d <= radius
958949
function Circle3D( x , y , z , nx , ny , nz , r ) {
	this.center = new Vector3D( x , y , z ) ;
	this.r = + r ;
	this.planeNormal = new Vector3D( nx , ny , nz ).normalizeCheck() ;
}
1235816
def draw_point(self, x, y):
        
        check_int_err(lib.SDL_RenderDrawPoint(self._ptr, x, y))
1160326
def draw_roundedrect(self, x, y, w, h, r=10):
        """"""
        # A****BQ
        # H     C
        # *     *
        # G     D
        # F****E

        context = self.context

        context.save

        context.move_to(x+r, y)  # Move to A
        context.line_to(x+w-r, y)  # Straight line to B
        context.curve_to(x+w, y, x+w, y, x+w, y+r)  # Curve to C
        # Control points are both at Q
        context.line_to(x+w, y+h-r)  # Move to D
        context.curve_to(x+w, y+h, x+w, y+h, x+w-r, y+h)  # Curve to E
        context.line_to(x+r, y+h)  # Line to F
        context.curve_to(x, y+h, x, y+h, x, y+h-r)  # Curve to G
        context.line_to(x, y+r)  # Line to H
        context.curve_to(x, y, x, y, x+r, y)  # Curve to A

        context.restore
1270332
def center_at(self, x, y):
        """"""

        self.x = x - (self.width / 2)
        self.y = y - (self.height / 2)
909270
def drawcircle(self, x, y, r = 10, colour = None, label = None):
        
        
        self.checkforpilimage()
        colour = self.defaultcolour(colour)
        self.changecolourmode(colour)
        self.makedraw()
        
        (pilx, pily) = self.pilcoords((x,y))
        pilr = self.pilscale(r)
        
        self.draw.ellipse([(pilx-pilr+1, pily-pilr+1), (pilx+pilr+1, pily+pilr+1)], outline = colour)
        
        if label != None:
            # The we write it :
            self.loadlabelfont()
            textwidth = self.draw.textsize(label, font = self.labelfont)[0]
            self.draw.text((pilx - float(textwidth)/2.0 + 2, pily + pilr + 4), label, fill = colour, font = self.labelfont)
1334387
def rectangle(self, x, y, width, height, corner_radius = 0):
        """"""
        if corner_radius <= 0:
            self._add_instruction("rectangle", x, y, width, height)
            return

        # convert into 4 border and  make sure that w + h are larger than 2 * corner_radius
        if isinstance(corner_radius, (int, float)):
            corner_radius = [corner_radius] * 4
        corner_radius = [min(r, min(width, height) / 2) for r in corner_radius]

        x2, y2 = x + width, y + height
        self._rounded_rectangle(x, y, x2, y2, corner_radius)
823409
def draw_circle(radius_in_meters, center_point, steps=15):
    
    steps = steps if steps > 15 else 15
    center = [center_point['coordinates'][1], center_point['coordinates'][0]]
    dist = (radius_in_meters / 1000) / 6371
    # convert meters to radiant
    rad_center = [number2radius(center[0]), number2radius(center[1])]
    # 15 sided circle
    poly = []
    for step in range(0, steps):
        brng = 2 * math.pi * step / steps
        lat = math.asin(math.sin(rad_center[0]) * math.cos(dist) +
                        math.cos(rad_center[0]) * math.sin(dist) * math.cos(brng))
        lng = rad_center[1] + math.atan2(math.sin(brng) * math.sin(dist)
                                         * math.cos(rad_center[0]), math.cos(dist) - math.sin(rad_center[0]) * math.sin(lat))
        poly.append([number2degree(lng), number2degree(lat)])
    return {"type": "Polygon", "coordinates": [poly]}
730265
def star(poly, trans, draw)
      x, y, n = poly.x, poly.y, poly.n
      inner_radius, outer_radius = poly.inner_radius, poly.outer_radius
      use_cairo do |cc|
        cc.rotate_about(x, y, trans.angle)
        cc.move_to(x + outer_radius, y) # i = 0, so cos(0)=1 and sin(0)=0
        theta = Math::PI / n.to_f # i.e. (2*pi) / (2*n)
        0.upto(2 * n) do |i|
            radius = i.even? ? outer_radius : inner_radius
            cc.line_to(x + radius * Math::cos(i * theta),
                       y + radius * Math::sin(i * theta))
        end
        cc.close_path
        cc.fill_n_stroke(draw)
      end
    end
73037
def circles_pycairo(width, height, color):
    

    cairo_color = color / rgb(255, 255, 255)

    surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
    ctx = cairo.Context(surface)

    # draw a circle in the center
    ctx.new_path()
    ctx.set_source_rgb(cairo_color.red, cairo_color.green, cairo_color.blue)
    ctx.arc(width / 2, height / 2, width / 2, 0, 2 * pi)
    ctx.fill()

    surface.write_to_png('circles.png')