Meshroom
Meshroom copied to clipboard
Fix 3D Viewer zooming problem
Description
When zooming in the 3D Viewer, we get stuck when we come the camera position and the viewpoint are too close. This fix solves this problem by not allowing us those two points to get too close. Solved with @almarouk and @Just-Kiel
Implementation remarks
The zoom and dezoom depends on the distance between camera and center position, if this distance is too low, the translation we apply to zoom/dezoom won't have any impact in the worst case as we are limited by float representation (and that's why we are stuck), or would be very low in the other case (and we'll need more user actions to have a visible dezoom).
There are two possibilities for the camera position to be too close to the center. 1/ We forbid too big zoom, as it means the distance between camera and center would be too low and we'll have no translation after (due to float representation) 2/ We forbid too small zoom as it means we are getting very close to center position and next zoom may lead to similar problem as previous case (no translation)
We could have done it in another way: if we compute the next camera position (without applying it), and test future dezooms with the new distance, we can notice if it will lead the 3D viewer to be stuck and forbid this camera position. We didn't do it, as it is leading to a more complex code and a higher computational cost, and our code already solves this issue in a convenient way for the user.