January 26, 2021, 06:33:51 AM

### Author Topic: [bb] Plot a circle by Shagwana [ 1+ years ago ]  (Read 529 times)

#### BlitzBot

• Jr. Member
• Posts: 1
##### [bb] Plot a circle by Shagwana [ 1+ years ago ]
« on: June 29, 2017, 12:28:38 AM »
Title : Plot a circle
Author : Shagwana
Posted : 1+ years ago

Description : This is a little function that plots a circle one-eight at a time.

Code :
Code: BlitzBasic
2.   x=0
5.   Plot(xpos+x,ypos+y)  ;Draw the starting pixels
6.   Plot(xpos-x,ypos-y)
7.   Plot(xpos+x,ypos-y)
8.   Plot(xpos-x,ypos+y)
9.   Plot(xpos+y,ypos+x)
10.   Plot(xpos-y,ypos-x)
11.   Plot(xpos+y,ypos-x)
12.   Plot(xpos-y,ypos+x)
13.   While y>x            ;Loop the arc
14.    If h<0
15.      h=h+(2*(x+1))
16.      x=x+1
17.      Else
18.      h=h+(2*(x-y))+5
19.      x=x+1
20.      y=y-1
21.      EndIf
22.     Plot(xpos+x,ypos+y) ;Draw 1/8 at a time
23.     Plot(xpos+y,ypos+x)
24.     Plot(xpos-x,ypos-y)
25.     Plot(xpos-y,ypos-x)
26.     Plot(xpos-x,ypos+y)
27.     Plot(xpos-y,ypos+x)
28.     Plot(xpos+x,ypos-y)
29.     Plot(xpos+y,ypos-x)
30.     Wend
31.   End Function