Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Angle, Vector, Radian, and Distance Library
#6
Shouldn't 0 Degrees = 0 Radians be due East to match the Trig Functions in BASIC?

And you do know about _D2R and _R2D that convert Degrees to Radians and vice versa?

Code: (Select All)
Screen _NewImage(800, 600, 32)
Do
    Cls
    For a = 0 To 2 * _Pi - .01 Step _Pi(2 / 36)
        x = 400 + 200 * Cos(a)
        y = 300 + 200 * Sin(a)
        _PrintString (x, y), Str$(Int(_R2D(a) + .5))
    Next
    While _MouseInput: Wend
    mx = _MouseX: my = _MouseY
    a = _Atan2(my - 300, mx - 400)
    If a < 0 Then a = a + 2 * _Pi
    Line (400, 300)-(400 + 150 * Cos(a), 300 + 150 * Sin(a)), &HFFFFFF00
    _PrintString (388, 292), _Trim$(Str$(Int(_R2D(a) + .5)))
    _Display
    _Limit 60
Loop

   

Note: the Degrees labels are a little off center to circle center, it's just a quick demo.
b = b + ...
Reply


Messages In This Thread
RE: Angle, Vector, Radian, and Distance Library - by bplus - 08-27-2022, 03:34 PM



Users browsing this thread: 1 Guest(s)