Advertisement
Guest User

Untitled

a guest
Jan 29th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.43 KB | None | 0 0
  1. class Circle
  2.   self.get_circle(x_center, y_center, r, color, bitmap)
  3.     x = 0
  4.     y = r
  5.     d = r - 1
  6.     while(y >= x)      
  7.       bitmap.set_pixel(x, y, color)
  8.       if(d >= 2 * x)
  9.         d = d - 2 * x - 1
  10.         x+=1
  11.       elsif(d <= (2 * r - y))
  12.         d = d + 2 * y - 1
  13.         y-=1
  14.       else
  15.         d + 2 * (y - x - 1)
  16.         y = y -1
  17.         x +=1
  18.       end        
  19.     end
  20.     return bitmap
  21.   end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement