# Intro

Given radius $$\r\$$, draw a circle in the center of the screen.

Sandbox.

# The Challenge

Here is a simple challenge.

Plot a circle using the formula $$\x^2+y^2=r^2\$$, or any other formula that will plot a circle according to the given parameters.

You may use any units that your language provides, so long as they are well defined and give consistent output.

The circle must have it's center at the center of the canvas, and must have a padding of 5 units or more on all sides.

The circle can have any fill that does not match the outline.

You may have axes in the background of your plot.

The outline of the circle must be solid (no gaps), and it must be visible. Here is an example:

Input can be taken in any acceptable form. (function params, variables, stdin...)

Output can be in the form of a separate window, or an image format.

Standard loopholes and rules apply.

# Example Code (Java + Processing)

// Modified from the C language example from
// https:// en.wikipedia.org/wiki/Midpoint_circle_algorithm
void settings() {
size(2*r+10, 2*r+10);
}

void draw() {
background(255);
drawCircle(width/2, height/2, r, 60);
save("Circle.png");
}

void drawCircle(int x0, int y0, int radius, int angle) {
int circCol = color(0, 0, 0);
int y = 0;
int err = 0;

while (x >= y && atan2(y, x) < limit) {
set(x0 + x, y0 + y, circCol);
set(x0 + y, y0 + x, circCol);
set(x0 - y, y0 + x, circCol);
set(x0 - x, y0 + y, circCol);
set(x0 - x, y0 - y, circCol);
set(x0 - y, y0 - x, circCol);
set(x0 + y, y0 - x, circCol);
set(x0 + x, y0 - y, circCol);

y += 1;
if (err <= 0) {
err += 2*y + 1;
}
if (err > 0) {
x -= 1;
err -= 2*x + 1;
}
}
}


# Scoring

This is a question. No ascii art.

This is . shortest answer in each language wins.

• What do you mean by 'the thickness of the outline must be 1 unit'? Are the units of outline thickness the same as those of the radius? Commented Sep 22, 2020 at 6:49
• yes, it doesn't make sense. I changed it. Commented Sep 22, 2020 at 6:53
• Related (Draw a Polygon)
– Jo King
Commented Sep 22, 2020 at 8:04
• You say there should be a padding of 5 units, what should happen if radius is bigger than window size? Commented Sep 22, 2020 at 8:36
• If we can zoom, wouldn't the same constant-sized circle, not showing axes, work for any input?
– att
Commented Sep 23, 2020 at 6:58

# Robocompass, 16 bytes

arc(0,0,a,0,360)


Where you have to define a before that as input.

• I don't think this is a permitted input method. Commented May 9, 2022 at 8:56
• @WheatWizard but as far as I am concerned it is the only way in robocompass. :-( Commented May 10, 2022 at 4:45

# Desmos, 3 bytes

r=1


Simply entering r, in my concern, doesn't work, but entering r=0 automatically makes it a slider.

r=0 doesn't create a circle. Sorry about that.

• Pasting this into desmos doesn't seem to produce a circle. Commented May 9, 2022 at 8:58
• @WheatWizard fixed Commented May 10, 2022 at 4:45