I thought of using the two-finger gesture on the iPad to zoom in and out and move parallel to the screen.
At first, I implemented βthe amount of shift of the center of gravity of two fingers as parallel shift and the ratio of increase or decrease of the distance between fingers as scaling,β but this is not correct.
How is it incorrect? Let o1 and o2 be the touch start positions and p1 and p2 be the current touch positions.
For example, suppose you shrink your finger by 1/2 while keeping the center of gravity at the edge of the screen. (4, 0), (4, 4) β (4, 1), (4, 3)
In this case, the above formula would shrink by 1/2 without parallel shift. It is wrong whether it is to the origin or to the center of the screen.
It needs to contract against the center of gravity of the two fingers.
Now, if we describe the deformation f in general as βx, y parallel shift after s times with respect to the originβ, what happens to this s, x, y, respectively?
would be ideal, but is not feasible for some touch movements because the deformation does not include rotation. So we minimize . ( least-squares method )
Differentiate E by s, x, and y, respectively, and set it to 0. Organize Eq. Substituting this for the derivative in s and never organizing x and y gives the formula for s.
Reference: Differentiation in s
It is easy to show that this is different from βthe shift of the center of gravity of two fingers as a parallel shift and the ratio of increase or decrease of the distance between the fingers as a scaling. For example, a move like this would be about 0.7x in the type that uses the increase or decrease in finger spacing as the magnification factor. But if we try to minimize the error under the condition of βno rotationβ, it is correct to multiply by 0.5. The above formula can be properly answered as βmultiply by 0.5 and move (2, 1)β.
This page is auto-translated from /nishio/δΊζ¬ζγΈγ§γΉγγ£γ§γΊγΌγ γ¨εΉ³θ‘移ε using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. Iβm very happy to spread my thought to non-Japanese readers.