Drawing an ellipse
#2
Oh I messed up this is easier than I thought to fit width and height: (leave the start and stop radians blank)
Code: (Select All)
Screen _NewImage(800, 600, 32)

For aspect = .5 To 1.51 Step .1
    Cls
    Line (200, 100)-(600, 500), &HFFFF00FF, B
    Circle (400, 300), 200, &HFFFFFF00, , , aspect
    _PrintString (400 - 8, 300 - 8), _Trim$(Str$(aspect))
    _Delay 2
Next

So to draw an ellipse with width and height:
Code: (Select All)
Screen _NewImage(800, 600, 32)
Do
    Cls
    Input "Please enter height, width integers don't forget comma "; h, w
    Line (400 - w / 2, 300 - h / 2)-(400 + w / 2, 300 + h / 2), &HFFFF0000, B
    drawEllipse 400, 300, w, h, &HFFFFFF00
    Sleep
    Paint (400, 300), &HFF008800, &HFFFFFF00
    Sleep
Loop

Sub drawEllipse (OriginX, OriginY, Wide, High, clr~&)
    If Wide > High Then r = Wide / 2 Else r = High / 2
    Circle (OriginX, OriginY), r, clr~&, , , High / Wide
End Sub
b = b + ...
Reply


Messages In This Thread
Drawing an ellipse - by PhilOfPerth - 07-01-2023, 08:14 AM
RE: Drawing an ellipse - by bplus - 07-01-2023, 10:04 AM
RE: Drawing an ellipse - by PhilOfPerth - 07-01-2023, 11:34 AM
RE: Drawing an ellipse - by OldMoses - 07-01-2023, 05:23 PM
RE: Drawing an ellipse - by bplus - 07-01-2023, 05:34 PM
RE: Drawing an ellipse - by PhilOfPerth - 07-01-2023, 11:26 PM
RE: Drawing an ellipse - by mnrvovrfc - 07-02-2023, 01:07 AM
RE: Drawing an ellipse - by PhilOfPerth - 07-02-2023, 01:21 AM
RE: Drawing an ellipse - by OldMoses - 07-02-2023, 02:12 AM
RE: Drawing an ellipse - by PhilOfPerth - 07-03-2023, 12:35 AM
RE: Drawing an ellipse - by mnrvovrfc - 07-03-2023, 01:40 AM
RE: Drawing an ellipse - by OldMoses - 07-03-2023, 03:52 AM
RE: Drawing an ellipse - by PhilOfPerth - 07-03-2023, 06:12 AM
RE: Drawing an ellipse - by SMcNeill - 07-03-2023, 06:16 AM
RE: Drawing an ellipse - by PhilOfPerth - 07-03-2023, 06:19 AM
RE: Drawing an ellipse - by SMcNeill - 07-03-2023, 06:24 AM
RE: Drawing an ellipse - by PhilOfPerth - 07-03-2023, 07:04 AM
RE: Drawing an ellipse - by mnrvovrfc - 07-03-2023, 06:34 AM
RE: Drawing an ellipse - by johnno56 - 07-03-2023, 07:06 AM
RE: Drawing an ellipse - by SMcNeill - 07-03-2023, 07:18 AM
RE: Drawing an ellipse - by bplus - 07-03-2023, 12:13 PM
RE: Drawing an ellipse - by OldMoses - 07-04-2023, 06:18 PM
RE: Drawing an ellipse - by bplus - 07-04-2023, 11:31 PM
RE: Drawing an ellipse - by PhilOfPerth - 07-05-2023, 01:58 AM
RE: Drawing an ellipse - by bplus - 07-05-2023, 02:28 AM
RE: Drawing an ellipse - by PhilOfPerth - 07-05-2023, 02:47 AM
RE: Drawing an ellipse - by OldMoses - 07-06-2023, 09:30 PM



Users browsing this thread: 9 Guest(s)