So, I have radian angles without any range (-inf to +inf basically) and I need to interpolate these as quick as possible. If there any cookie cutter way to do this?
PS: I only need to interpolate 2 values at a time, so a+f*(b-a) basically
PPS: the output does NOT have to be in any specific range (-PI to PI or 0 to 2PI)
PPPS: The specific problem is how to do the wrapping of the values around -PI/+PI and their multiples most efficiently
BETTER Actually forget what I wrote first. You can simply do:
where
wrapMP
moves an angle to the interval [-pi|+pi]. Both inputu
andv
can be any radian angle and the result will also not be in a specific interval.The idea is actually quite simple. Move your point of view to the point
u
such thatu=0
. Nowv
can be arbitrary as angles are not normalized, but we just wrap the distancev-u = v
to [-pi|+pi] and walk by the given percentagep
into that direction.OLD (and inefficient) I wrote this code once:
where
wrap2i
moves an angle to the interval [0,2*pi[.