Closed haoda-li closed 3 years ago
There is something odd about this. Here we should be accumulating forces, which are the negative of dV. Your fix adds a potential energy gradient to a force which feels incorrect. Perhaps you should double check your potential energy gradient ...
Are you assembling the negative gradients in assemble_forces
? That would make the signs consistent.
I expect the mouse drag will pull the closest vertex to the dragged position and bounce back, while in the program the vertex is pulled to the opposite direction. The issue is that on main.cpp line 65, instead of
f.segment<3>(3*Visualize::picked_vertices()[pickedi]) -= dV_mouse.segment<3>(3);
the code should bef.segment<3>(3*Visualize::picked_vertices()[pickedi]) += dV_mouse.segment<3>(3);
This small fix should make the interaction looks more "correct". It won't impact the actual assignment implementations.