File:Concentric circles drawn with Bresenham's circle algorithm.png

From testwiki
Jump to navigation Jump to search
    Original file (301 × 301 pixels, file size: 5 KB, MIME type: image/png)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    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:
    Creative Commons CC-Zero 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.

    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()
    

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    25 November 2018

    image/png

    81f5c9770123609e54cfc97a0b033f784f427ffc

    5,579 byte

    301 pixel

    301 pixel

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current18:52, 13 December 2020Thumbnail for version as of 18:52, 13 December 2020301 × 301 (5 KB)wikimediacommons>PsiĥedelistoNew version after email complaint. Source code: https://github.com/ctrlcctrlv/Midpoint-circle-algorithm-Wikipedia-images/blob/main/multicolor_circle.py

    There are no pages that use this file.