Codesnippets > 2D-snippets

2D drawdisc() drawcircle()

<< < (6/6)

fuzzy70:
The thing about the one I posted based on ocean's code is that it only requires 1 call each to sin & cos, also it automatically increases the amount of  segments the larger the circles get.

Glad you got a version working that's faster than the original pixel plotting one :-)

Lee

Sent from my Xperia Z using Tapatalk 2

sf-in-sf:
It took me a while to learn and experiment with POLYVECTOR.
The code could be faster: I just noticed that each segment calculates 2 sin and 2 cos, i.e. 2x too much.... the new point's coordinates must be kept in memory (static for example) and used later for the next segment, as the old point. No need to calculate twice.
I'm busy now. Please have a go and see if that new version is really faster. If it goes very fast then SHOWSCREEN will set a limit of 60 objects per second, which isn't right. I'll be back next week or so.

Elemee:
I am brand new to GLB, and am trying to recode a game I created in SiMPLE Basic that happens to make use of built in 2D primitives in that language. like Solidcircle().  Is there no built-in graphics primitive in GLB to do circles, ellipses, or other figures?  Is that is why this thread exists?  If so, would you be so kind as to point me to the simplest way to code a filled circle in GLB?  Your help would be much appreciated.

Ian Price:
Try both examples above by fuzzy70 and sf-in-sf. There are other alternatives to using POLYVECTOR commands too.

Navigation

[0] Message Index

[*] Previous page

Go to full version