Kinda confusing to be honest ! I thought I got it right ..
I did some adjustments to my VV algorithem according to what you said, now energy goes between 25 to 25.00003 which is still better then Euler.
so I changed from :
Code:
a = pState(this,r,v,a);
r += (v * dt) + (a * 0.5f * dt * dt); //.. r(t+dt)
v += (a*mass + pState(this,r,v,a)) * (0.5f * dt /mass); //.. v(t+2*dt/2)
to
Code:
r += (v * dt) + (prev_a * 0.5f * dt * dt); //.. r(t+dt)
v += prev_a*0.5f*dt;
a = pState(this,r,v,prev_a) / mass;
prev_a = a;
v += a * 0.5f * dt; //.. v(t+dt)
so the trick is that I just calculate the force in a difference place in the algorithem (didnt thought about it before).
One problem is that when i do speed-check (using milliseconds clock()) I get about the same running time for both, I think its because the latter use more lines of codes and its harder to 'simplify' it like the first one which is just 2 lines and no division of vector by scalar.
EDIT: I made some adjustments, VV now is 300 ms (while previously was 360 ms) and euler stays at about 215 ms.
Thanks for clarifying it to me