circle points

Blitz3D Forums/Blitz3D Beginners Area/circle points

blade007(Posted 2008) [#1]
I need some help with circles. I need to manually create a circle (point by point). Any ideas?


PGF(Posted 2008) [#2]
Lookup
- Midpoint Circle Algorithm
- Bresenham's Circle Algorithm (incorrect but common name)

Might even be an example in the Code Archives


Stevie G(Posted 2008) [#3]
graphics 800,600,32,1
setbuffer backbuffer()

const AngleStep# = .1
global Radius# = 100
global X# = graphicswidth()*.5
global Y# = graphicsheight()*.5

for Angle# = 0 to 360-AngleStep step AngleStep
   plot X + Radius * cos( Angle), Y + Radius * sin( Angle )
next
   
flip

mousewait



Nate the Great(Posted 2008) [#4]
X = (cos(angle)*radius)+ Xcenter ;Xcenter = X coordinate of the center of the circle
Y = sin(angle)*radius + Ycenter ;Ycenter = Y coordinate of the center of the circle



Ross C(Posted 2008) [#5]
Yep, the good old simple way. Note that the larger your circle, the more points you will need to draw an unbroken outline. Also depends on the screen resolution too.


blade007(Posted 2008) [#6]
thank you all!!

I wanted to use this to make explosion formations in a circle. So my code kinda looks like...
explode\vx = (explode\x-(explode\x + 50 * Cos( Angle# )))/2
explode\vy = (explode\y-(explode\y + 50 * Sin( Angle# )))/2