Android Question Calculate the angle like the B4X Turtle Arrow

skyracer90

Member
Licensed User
Longtime User
Hello dear Community,
maybe someone can help me.
How can i calculate the angle like the B4X Turtle does with the arrow?
I move an X and Y axis and now want to calculate the setting angle in degree for the A axis like the Turtle Arrow... Unfortunately I have no mathematical idea ...
Thanks for every approach. Of course I don't want to use the "Turtle" function ...
 

klaus

Expert
Licensed User
Longtime User
I would suggest to use ATan2 or ATan2D instead of ATan or ATan2.
ATan2 (Y As Double, X As Double)
You enter x and y and the method does the rest, no need to check it y = 0.
Log(ATan2D(10, 0)) returns 90°
Log(ATan2D(-10, 0)) returns -90°
 
Upvote 1
Top