Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Playing with code: a circle function using triangle math
#3
(09-13-2023, 07:50 PM)bplus Wrote: this might be interesting:
Code: (Select All)
Screen _NewImage(400, 400, 32)
r = 100
cx = _Width / 2: cy = _Height / 2
For x = 0 To r
    y = Sqr(r * r - x * x)
    PSet (cx - x, cy - y)
    PSet (cx + x, cy - y)
    PSet (cx - x, cy + y)
    PSet (cx + x, cy + y)


    ' remove comments for no holes
    PSet (cx - y, cy - x)
    PSet (cx + y, cy - x)
    PSet (cx - y, cy + x)
    PSet (cx + y, cy + x)
Next

That's awesome, and kind of funny.

I've been mulling this in the back of my sponge all day, and I was just about to sit down and code something similar when I saw your reply.

I'm going to write up a blog entry about my own code and a testing app for it to compare performance of the alternative CIRCLE approach compared to the implementation of CIRCLE in wwwBASIC as it was when I nabbed it and how it still is today.
Reply


Messages In This Thread
RE: Playing with code: a circle function using triangle math - by CharlieJV - 09-14-2023, 12:02 AM



Users browsing this thread: 1 Guest(s)