Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fast filled circle
#3
This has been tested and tested again, it uses 8 point octal calculations and holds up aginst memory techniques with even alpha shading (no overlapping), very fast and efficient.
Code: (Select All)
'from Steve "Gold standard"
Sub fcirc (CX As Long, CY As Long, R As Long, C As _Unsigned Long)
    Dim Radius As Long, RadiusError As Long
    Dim X As Long, Y As Long
    Radius = Abs(R): RadiusError = -Radius: X = Radius: Y = 0
    If Radius = 0 Then PSet (CX, CY), C: Exit Sub
    Line (CX - X, CY)-(CX + X, CY), C, BF
    While X > Y
        RadiusError = RadiusError + Y * 2 + 1
        If RadiusError >= 0 Then
            If X <> Y + 1 Then
                Line (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
                Line (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
            End If
            X = X - 1
            RadiusError = RadiusError - X * 2
        End If
        Y = Y + 1
        Line (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
        Line (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
    Wend
End Sub

Got it from Steve but he didn't invent it. fcirc is short for Filled Circle. The only place it doesn't work well is dbox's QBJS
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
Fast filled circle - by mdijkens - 11-26-2022, 03:20 PM
RE: Fast filled circle - by CharlieJV - 11-26-2022, 03:58 PM
RE: Fast filled circle - by bplus - 11-26-2022, 04:19 PM
RE: Fast filled circle - by dbox - 11-26-2022, 10:43 PM
RE: Fast filled circle - by bplus - 11-26-2022, 10:54 PM
RE: Fast filled circle - by mdijkens - 11-26-2022, 11:13 PM
RE: Fast filled circle - by bplus - 11-26-2022, 11:29 PM
RE: Fast filled circle - by SMcNeill - 11-27-2022, 01:44 AM
RE: Fast filled circle - by SMcNeill - 11-27-2022, 01:46 AM
RE: Fast filled circle - by gaslouk - 11-27-2022, 04:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fast Primes SMcNeill 17 3,826 06-06-2024, 04:44 AM
Last Post: eoredson
  polyFT - draw filled polygons James D Jarvis 5 1,287 08-22-2023, 08:47 PM
Last Post: johnno56
  fhex ... a Filled Hex James D Jarvis 2 946 08-19-2023, 08:13 PM
Last Post: James D Jarvis
  Mod'ing a classic- partial circle fill OldMoses 6 1,294 01-17-2023, 07:11 PM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)