Pinch gesture is modified to use product(dz) instead of sum(dz)

Sum(dz) is replaced with product of max of (dz, 1/dz). As a result,
the PinchValidator matches the actual pinch ratio. Moreover, it would
be easier to compare zoom-in and zoom-out gestures.

BUG=none
TEST=CL:340186
CQ-DEPEND=CL:340186

Change-Id: Idd53531fefcf6778af5ba70a39039e5f4b9e24e5
Reviewed-on: https://chromium-review.googlesource.com/340250
Commit-Ready: Amirhossein Simjour <asimjour@chromium.org>
Tested-by: Amirhossein Simjour <asimjour@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
diff --git a/mtlib/gesture_log.py b/mtlib/gesture_log.py
index fefa336..31cc8d6 100755
--- a/mtlib/gesture_log.py
+++ b/mtlib/gesture_log.py
@@ -236,7 +236,7 @@
 class PinchGesture(AxisGesture):
   """ The pinch gesture is functionally the same as the MotionGesture.
 
-  However only uses the dx variable to represent the zoom factor.
+  However only uses the dz variable to represent the zoom factor.
   """
   type = 'Pinch'
 
@@ -247,6 +247,14 @@
     fstr = '{0} dz={1:.4g} r={2:.4g}'
     return fstr.format(self.__class__.type, self.dz, self.Roughness())
 
+  def Append(self, motion):
+    self.dx = self.dx + motion.dx
+    self.dy = self.dy + motion.dy
+    self.dz = self.dz * max(motion.dz, 1 / motion.dz)
+    self.distance = self.dz
+    self.segments.append(motion.distance)
+    self.end = motion.end
+
 
 class SwipeGesture(MotionGesture):
   """ The swipe gesture is functionally the same as the MotionGesture """