On my machine the test for the interpolation of the velocity vector fails.
I think it is because the finite difference method is always using interpolateDerivative on the unit interval [0,1], while the analytical linearisation is evaluated on the interval [0,intervalLength].
When I fix intervalLength = 1 the test passes.
Am I missing something?
Unfortunately, even with !3 (closed) , rotationtest.cc still fails (just a bit later). @jyouett , could you have a look?
Ideally, I'd like to get rid of the interpolation methods in rodlocalstiffness.hh, and use the general code in LocalGeodesicFEFunction instead. But that needs proper testing to not break anything.
Concerning the second point, I actually encountered some problems when using the general code: Ipopt which is used to solve the small optimisation problems is not always converging. I think it happened when the quaternions representing rotations were not on the same half of the coverage. I can try to reproduce the error and write a test
I am at this very moment hunting a bug in the SO(3)-valued interpolation that sounds very much what you describe. I've already got it cornered in quite closely. Could you rather have a look at why rotationtest.cc stills fails with !3 (closed) ? Thanks!
I also ran into another "error" in the difference method, which is used in the interpolation: When the quaternions are not on the same coverage the fourth entry may become smaller than -1 which should be captured the same way as it is done for the case > 1
I fixed it by extending the test to
if (std::fabs(diff[3]) > 1.0)
I think I found out why the test is not running: The method Rotation::interpolateDerivative assumes that the interval is of length 1. Hence the finite difference gradients, which are computed by this interpolation method, are different when checked against the analytic ones on a scaled interval. Further, this dependency is non-linear (I think) which is why one cannot simply re-scale the FD gradients afterwards. I wrote a second method Rotation::interpolateDerivative(intervalLength) which takes into account a general interval length. With this method the test runs (without the changes in !3 (closed)) I attach it hereinterpolateDerivativeWithSteplength.h
Okay I found the bug: The method LocalRodStiffness::interpolationVelocityDerivative expects an input value from the interval [0,IntervalLength]. The test however puts in a value from the unit interval.
By changing the input from s to s*intervalLength the test passes again (without using the method I attached)