Figuring an angle?

Das Goravani goravanis at gmail.com
Sun Oct 10 20:15:07 UTC 2021


On evMouseDown
While mousedn()
Calculate touchX as mouseover(kMHorz)
Calculate touchY as mouseover(kMVert)
Calculate deltaX as 200-touchX
Calculate deltaY as 200-touchY
Calculate iresult as atan2(deltaY,deltaX)
If iresult>0
Calculate iresult2 as iresult
Else
Calculate iresult2 as 360+iresult
End If
Redraw result,result2
End While

The above works to return the angle from 0 to 360 with zero being at 9 o’clock on the window relative to center

In our code here 200 is the center of the window both $left and $top.. 400 pixel window both ways

This is super fast, it stays up with you

That was easy. Well, given help from the web. 


More information about the omnisdev-en mailing list