Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Polygon playground
#3
7 years ago I was doing polygons!
Code: (Select All)
_Title "Polygon Demo by bplus"
' polygon demo.bas for QB64 (B+=MGA) 2017-09-17
Const xmax = 700
Const ymax = 700

Screen _NewImage(xmax, ymax, 32)
_Delay .25
_ScreenMove _Middle

x0 = xmax / 2: y0 = ymax / 2
For n = 3 To 9
    radius = 345
    Cls
    rr = Rnd * 75: gg = Rnd * 75: bb = Rnd * 75
    For a = 0 To _Pi(2) Step _Pi(1 / 20)
        radius = radius - 8
        pc& = _RGB(radius / 345 * 200 + rr, radius / 345 * 200 + gg, radius / 345 * 200 + bb)
        Color pc&
        polygon x0, y0, radius, n, a
        Paint (x0, y0), pc&, pc&
        _Limit 10
    Next
    Sleep 2
Next

Sub polygon (xOrigin, yOrigin, radius, nVertex, RadianAngleOffset)
    polyAngle = _Pi(2) / nVertex
    x1 = xOrigin + radius * Cos(polyAngle + RadianAngleOffset)
    y1 = yOrigin + radius * Sin(polyAngle + RadianAngleOffset)
    For i = 2 To nVertex + 1
        x2 = xOrigin + radius * Cos(i * polyAngle + RadianAngleOffset)
        y2 = yOrigin + radius * Sin(i * polyAngle + RadianAngleOffset)
        Line (x1, y1)-(x2, y2)
        x1 = x2: y1 = y2
    Next
End Sub

Looks like I was filling with Paint back then, later versions I filled with fTri (Filled Triangles) way way faster! Plus could then do transparent colors.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
Polygon playground - by Dav - 08-28-2024, 06:48 PM
RE: Polygon playground - by Dav - 09-01-2024, 05:10 PM
RE: Polygon playground - by bplus - 09-01-2024, 05:58 PM
RE: Polygon playground - by bplus - 09-01-2024, 06:04 PM
RE: Polygon playground - by Dav - 09-01-2024, 06:14 PM
RE: Polygon playground - by RokCoder - 09-23-2024, 01:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Photo Wallpaper creator from repeated polygon patterns mnrvovrfc 5 1,349 01-31-2024, 09:43 AM
Last Post: SMcNeill
  Polygon Artwork SierraKen 2 859 07-12-2022, 05:09 AM
Last Post: SierraKen

Forum Jump:


Users browsing this thread: 1 Guest(s)