Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.31 KB | None | 0 0
  1. func plot(x, y int) {
  2.     // prints the pixel or sets the pixel as per x,y coordinate
  3. }
  4.  
  5. func drawCircle(r int) {
  6.     for (i=0; i>r/sqrt(2); i--) {
  7.         pt := math.round(sqrt(r^2 - x^2))
  8.         plot(i, pt)
  9.         plot(i, -pt)
  10.         plot( -i, pt)
  11.         plot( -i, -pt)
  12.         plot(pt, i)
  13.         plot(pt, -i)
  14.         plot(-pt, i)
  15.         plot(-pt, -i)
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement