Page 1 of 1

A demo of the atan2() function approach, to calculate the angle between 2 points.

Posted: Tue Apr 19, 2022 7:44 pm
by svenvandevelde


Find attached a small demo program that calculates the angle between the middle point of the sceen and the mouse pointer position.




This demo only runs on the R39 emulator version of the cx16.




 




The angle calculated is between 0 and 63, so each quadrant in the circle has 16 different angles (0 to 15).




Please comment to the following article that goes into details on this atan2() approach ...





Sven



Made the logic working on the R38 and R39.