Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Created March 24, 2021 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save primaryobjects/a7caf148ea341ef49adf0779cd59e633 to your computer and use it in GitHub Desktop.
Save primaryobjects/a7caf148ea341ef49adf0779cd59e633 to your computer and use it in GitHub Desktop.
Algorithm to draw a circle.
* draw_circle xc, yc, r is 
*
* d := r/2 
*
* x := r 
*
* y := 0 
*
*  
*
* while x >= y loop 
*
* plot xc + x, yc + y 
*
* plot xc - x, yc + y 
*
* plot xc + x, yc - y 
*
* plot xc - x, yc - y 
*
* plot xc + y, yc + x 
*
* plot xc - y, yc + x 
*
* plot xc + y, yc - x 
*
* plot xc - y, yc - x 
*
*  
*
* y := y + 1 
*
* d := d - y 
*
* if d < 0 then 
*
* x := x - 1 
*
* d := d + x 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment