How can i correctly interpolate between 2 euler angles with a given time (or velocity)?
For instance, i want to implement a simple blink, rotating the lids first down and then up again. The time a blink takes should be between 50 and 500ms. At the moment i simply calculate the x value(for down) :
Eigen::Vector3f rotateLeftLidDown(float step)
{
return Eigen::Vector3f(-step*COMPLETE_CLOSURE,0,0);
}
//INTERPOLATION
float duration =gen_random_float(0.05f,0.5f);
for(float i=0;i<1;i=i+(duration))
{
LeftLid.push_back(rotateLeftLidDown(i));
}
for(float i=1;i>0;i=i-(duration))
{
LeftLid.push_back(rotateLeftLidUp(i));
}
Every calculating step is later popped from the sack and applied to the nodes at a 100hertz rate.. this approach can blink fast or slow, but it just doesnot seem right. I dont consider the speed of the eyelids and also the "interpolating" here is really dirty...is it better to transform the euler into quaternions or rotation matrices?
A function like blink(500ms), that considers a peak velocity for downward 280mm/s within 70ms and open the eyelid with about 100mm/s would really help me.