A quick note for future readers: the way you unlock with three fingers adds the distances ab, bc, ac.
However, if your graphics package just has a “triangle area” on hand - just use it. ("It saves one whole line of code!")
Hope this helps.
All you have to do is keep track of:
distance between three fingers!
Just add "every" permutation
(Well, there are three .. ab, ac and cb. Just add them to have everything!)
When this value, say, triple from the initial value, that "outward triple failure."
... amazing that is simple.
Angles do not matter.
Footnote if you want to be a smartphone: this applies to any pinch / unclean gestures, 2, 3 fingers, whatever:
track the derivative of the sum-distance (I mean speed), not the distance. (Unusually, this is often EASY TO DO !, because he is stateless! You only need to look at the previous frame !!!!)
In other words, a gesture is a trigger when the decomposition / contraction of the VELOCITY of the fingers reaches a certain value, and not a multiple of the starting value.
More interesting footnote!
However, there is a subtle problem: whenever you do something like this (on any platform), you have to be careful to measure "on glass ... p>
IF you just make a distance (that is, my first decision is higher), of course, everything is canceled, and you can just say “if it doubles” (in pixels - dots - no matter what happens). BUT, if you perform speed as part of the calculation in any gesture, then it is somewhat surprising that you need to literally find the speed in meters per second in the real world , which seems strange at first! Of course, you cannot do it for sure (especially with android). The size of the glass depends a little, but you need to get closer to it. Here is a long post discussing this issue http://answers.unity3d.com/questions/292333/how-to-calculate-swipe-speed-on-ios.html In practice, you usually have to do a "screen width per second" pretty good. (But it can be very different on phones, large tablets, and these days are “superficial” types of things. On your screen, the iMac 0.1 screenwidthspersecond can be fast, but on the iPhone it's nothing, not a gesture.)
Final footnote! I just don’t know if Apple uses “distance a few” or “glass speed” in gesture recognition, and it’s also probably a subtle mix. I never read an article from them, commenting on it.
Another footnote! - if for any reason you want to find the "center" of the triangle (I mean the center of three fingers). This is an interesting problem for game programmers, because, after all, all three-dimensional grids are triangles.
Fortunately, it is trivial to find the center of three points, just add three vectors and divide by three! (Vaguely it even works in higher dimensions !!)
You can see endless posts on this issue ...
http://answers.unity3d.com/questions/445442/calculate-uv-at-center-of-triangle.html
http://answers.unity3d.com/questions/424950/mid-point-of-a-triangle.html
Perhaps if you were incredibly anal, you would like the “barycenter” to be more like a center of mass, just Google, if you want it.