10-04-2024, 10:04 PM
Also Terry I was checking out your library and noticed a Vec2Deg function that was longer than the one I use. Is this simpler version as useful?
Code: (Select All)
Dim As Single Vx, Vy, angle
start:
Cls
Print "Type in vectors, Vx, Vy"
Input Vx: Input Vy
angle = Vec2Deg(Vx, Vy)
Print: Print "The answer is "; Using "###.###"; angle;: Print " degrees."
If Vx = 0 Or Vy = 0 Then System
Sleep
GoTo start:
Function Vec2Deg (Vx As Single, Vy As Single) '
' ** Turns vector pairs into degrees **
Dim As Double radian
Dim As Single degrees
radian = _Atan2(Vx, Vy) '
degrees = _R2D(radian) '
If degrees < 0 Then degrees = 360 + degrees '
Vec2Deg = degrees '
End Function