Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The Curve statement, an improved Circle
#1
Code: (Select All)

handle& = _NewImage(800, 600, 32)
Screen handle&

'-----------------------EXAMPLES------------------------------
curve 100, 100, 30, 1, 15, _RGB(250, 0, 0), 0, 90
curve 100, 100, 30, 1, 15, _RGB(0, 250, 0), 90, 180
curve 100, 100, 30, 1, 15, _RGB(0, 0, 250), 180, 270
curve 100, 100, 30, 1, 15, _RGB(250, 250, 0), 270, 360
curve 100, 100, 1, 1, 15, _RGB(250, 250, 250), 0, 360
curve 500, 400, 50, 1.5, 15, _RGB(250, 0, 0), 0, 60
curve 600, 250, 50, .5, 15, _RGB(250, 0, 0), 90, 210
curve 700, 400, 50, 1.5, 5, _RGB(0, 250, 0), 45, 135
curve 650, 400, 50, .5, 5, _RGB(0, 250, 0), 135, 270
curve 600, 200, 50, 1.5, 15, _RGB(0, 0, 250), 145, 235
curve 650, 290, 50, .5, 15, _RGB(0, 0, 250), 15, 170
curve 400, 150, 50, 1.5, 15, _RGB(50, 0, 150), 145, 160
curve 550, 270, 100, 1.8, 35, _RGB(50, 0, 150), 80, 270

curve 180, 400, 50, .5, 15, _RGB(0, 250, 0), 0, 180
curve 190, 400, 50, .8, 10, _RGB(0, 250, 0), 30, 180
curve 160, 410, 20, .8, 10, _RGB(0, 250, 0), 15, 140
curve 90, 395, 60, .7, 11, _RGB(0, 250, 0), 0, 120
curve 90, 400, 55, .6, 12, _RGB(0, 250, 0), 0, 160
curve 100, 415, 40, .8, 10, _RGB(0, 250, 0), 30, 140
curve 335, 400, 190, 1.5, 18, _RGB(80, 80, 0), 180, 230

curve 235, 500, 20, 1.5, 4, _RGB(230, 80, 0), 0, 360
curve 230, 540, 20, 1.5, 4, _RGB(230, 80, 0), 0, 45
curve 285, 482, 30, .55, 4, _RGB(230, 80, 0), 0, 90
curve 285, 482, 30, .55, 4, _RGB(230, 80, 0), 270, 360
curve 285, 518, 30, .55, 4, _RGB(230, 80, 0), 0, 90
curve 285, 518, 30, .55, 4, _RGB(230, 80, 0), 270, 360
curve 375, 502, 90, 2.55, 4, _RGB(230, 80, 0), 170, 188
curve 368, 515, 18, 1, 4, _RGB(230, 80, 0), 0, 360
curve 365, 500, 20, 1.5, 4, _RGB(230, 80, 0), 90, 230
curve 445, 480, 40, .6, 4, _RGB(230, 80, 0), 150, 290
curve 535, 505, 90, 2.55, 4, _RGB(230, 80, 0), 170, 188


k = 0
Do
    col1& = _RGB(0, 0, 0)
    curve 200, 200, 60, 1, 10, col1&, k, k + 10
    If k <= 350 Then k = k + 10 Else k = k - 350
    col1& = _RGB(Rnd * 150 + 100, 0, 0)
    curve 200, 200, 60, 1, 10, col1&, k, k + 10

    _Delay .02

    i = Int(Rnd * 36) * 10
    col1& = _RGB(Rnd * 150 + 100, 0, 0)
    curve 200, 200, 30, 1, 15, col1&, i, i + 10
    col1& = _RGB(0, Rnd * 150 + 100, 0)
    curve 200, 200, 14, 1, 14, col1&, i, i + 10
    col1& = _RGB(0, 0, Rnd * 150 + 100)
    curve 200, 200, 1, 1, 14, col1&, i, i + 10

Loop Until InKey$ <> ""
'--------------------END OF EXAMPLES------------------

End

' cleft, ctop : center of the circle/arc
' cRa : Radius
' caspect! : aspect, normal = 1
' cthick : thickness
' ccolor& : color
' cstart, cend : start/end of the arc in degrees, (from 3 o'clock - anticlockwise)
' cstart must be less than cend (0-360 degrees)
Sub curve (cleft, ctop, cRa, caspect!, cthick, ccolor&, cstart, cend)
    i = 90
    stars = 360
    ss = 1 'step
    sx = i * (360 / stars) 'x pos
    sy = i * (360 / stars) 'y pos
    For sr2 = cRa To cRa + cthick
        i2 = -1
        For k2 = 1 To 360
            sx = sx + ss: If sx >= 360 Then sx = 360 - sx
            sy = sy + ss: If sy >= 360 Then sy = 360 - sy
            sxf = Sin(_Pi * sx / 180) * sr2
            syf = Cos(_Pi * sy / 180) * sr2 * caspect!
            i2 = i2 + 1: If i2 > 360 Then i2 = i2 - 360 'i2:degrees
            If i2 >= cstart And i2 <= cend Then Line (cleft + sxf, ctop + syf)-(cleft + sxf + 1, ctop + syf + 1), ccolor&, BF
        Next k2
    Next sr2
End Sub
Reply


Messages In This Thread
The Curve statement, an improved Circle - by 2112 - 11-01-2025, 03:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Bright Circle Colors SierraKen 4 627 08-23-2025, 03:33 PM
Last Post: DANILIN
  Playing with dragon curve fractal Dav 11 2,500 10-09-2023, 12:23 AM
Last Post: Dav
  Improved my small Gradient Ball drawing SUB Dav 22 5,317 07-13-2023, 05:23 PM
Last Post: Dav
  Draw that Circle James D Jarvis 17 3,318 08-28-2022, 06:29 AM
Last Post: justsomeguy
  Rotating Circle CharlieJV 0 521 08-06-2022, 02:56 AM
Last Post: CharlieJV

Forum Jump:


Users browsing this thread: 1 Guest(s)