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

Possibly Related Threads…
Thread Author Replies Views Last Post
  Filled Triangle for BAM? bplus 3 965 08-13-2023, 01:42 AM
Last Post: CharlieJV
  Just a tiny and fun bit of code CharlieJV 6 1,658 06-15-2023, 02:54 PM
Last Post: CharlieJV
  BAM and the CIRCLE statement CharlieJV 4 1,362 06-12-2023, 11:41 AM
Last Post: CharlieJV
  BAM program: Triangle Math Studying CharlieJV 0 450 06-08-2023, 02:29 AM
Last Post: CharlieJV
  The best kind of documentation let's you try your own code, right there CharlieJV 2 742 03-25-2023, 06:07 PM
Last Post: CharlieJV

Forum Jump:


Users browsing this thread: 1 Guest(s)