Concentric_circles_drawn_with_Bresenham's_circle_algorithm.png
Summary
Description Concentric circles drawn with Bresenham's circle algorithm.png |
English:
The midpoint circle algorithm, also known as Bresenham's circle algorithm, run 150 times, each time with one pixel bigger to create the final image of "concentric" circles. In this case different colors were used to more obviously show the concentricity of the circles.
Source code: |
Date | |
Source | Own work |
Author | Psiĥedelisto |
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication . | |
The person who associated a work with this deed has dedicated the work to the
public domain
by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.en CC0 Creative Commons Zero, Public Domain Dedication false false |
Source code
The below source code is GFDL 1.2-licensed. Repository by User:Psiĥedelisto .
from rcbitmap import Bitmap
from rcbitmap import BLACK, WHITE, RED, GREEN, BLUE, TRANSPARENT
WIDTH = HEIGHT = 301
bitmap = Bitmap(WIDTH, HEIGHT, background=TRANSPARENT)
colours = list()
for i in range(0,25):
colours.append(BLACK if i%2 else RED)
for i in range(0,25):
colours.append(BLACK if math.ceil(i/2)%2 else RED)
for i in range(0,5):
colours.append(RED)
for i in range(0,5):
colours.append(BLACK)
for i in range(0,150-len(colours)):
colours.append(BLUE if math.floor(i/18)%2 else RED)
assert len(colours) == 150, "Not enough colours"
for i in range(1, 151):
bitmap.circle(x0=(WIDTH//2), y0=(HEIGHT//2), radius=i, colour=colours[i-1])
bitmap.xpm()