Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / creating "pizza slices"

Author
Message
making an expiration date
18
Years of Service
User Offline
Joined: 9th Jan 2006
Location:
Posted: 10th Jan 2006 16:26
In other BASIC languages, I can draw what looks like pizza slices of various sizes with the command:
FOR c = 0 TO PI2 STEP (PI2 / Den)
CIRCLE (XLOC, YLOC), Radius, , -c, -2Pi
NEXT c
where 2Pi is 2 times Pi radians in a whole circle
I see no such way to do this in Dark Basic. Is there one?
My purpose is to create "fraction circles" for my math students to identify and I'd prefer not to draw them all as bitmaps, having an almost endless number of them to deal with.
Thanks,
Steve

stevor
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Jan 2006 20:09
I'm not that great at math so there may be an easier way. But it can be done by drawing a line from an x and y coordinate to the radius of the circle you want, then draw lines from that starting point to the next angle (start angle + size) you want to stop at (using "cos" and "sin" to make a circle), then a line from that end angle to the starting x and y coordinate.

This code snip I threw together uses 50 as a size because it makes a nice fat slice. If you change it to 280 you see a pac-man like pie.

Hope this helps.




Login to post a reply

Server time is: 2024-09-24 13:28:58
Your offset time is: 2024-09-24 13:28:58