Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interpolating Radian Angles?

Tags:

c++

math

If I'm given a start angle of 1.0f, and an end angle of 6.0f, then what I really want to interpolate is not the 5 in between 1 and 6, but the smaller portion. This will cause counter clockwise interpolation. How can I account of this when interpolating?

Essentially, when given 2 radian angles from 0 to 6.283, how can I know if I should interpolate clockwise or counter clockwise based on which would be "shorter"?

Thanks

like image 354
jmasterx Avatar asked Jul 17 '26 06:07

jmasterx


1 Answers

Get the target angle minus starting angle. If that is greater than PI, go counterclockwise.

Invert the logic if the value is negative.

like image 186
EboMike Avatar answered Jul 18 '26 21:07

EboMike



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!