Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.
multiplier = (int)(1.0/rotation_speed + .5) // rounds
if(initial_position%multiplier > multiplier/2)
new_position = initial_position - initial_position%multiplier + multiplier
else
new_position = initial_position - initial_position%multiplier
You have a big problem however if the multiplier is not a factor of 180 (7,8,11,etc)if abs(current_position) <= multiplier/2
current_position = 0
if current_position <= multiplier/2 or current_position >= 180 - multiplier/2
current_position = 0
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.