circle points
Blitz3D Forums/Blitz3D Beginners Area/circle points
| ||
I need some help with circles. I need to manually create a circle (point by point). Any ideas? |
| ||
Lookup - Midpoint Circle Algorithm - Bresenham's Circle Algorithm (incorrect but common name) Might even be an example in the Code Archives |
| ||
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 |
| ||
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 |
| ||
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. |
| ||
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 |