User Tools

Site Tools


gestures:touch:advanced:gesture-filtering:n-rotate-inertia

N-Rotate-Inertia

(Touch → Advanced → Gesture Filtering → N Point Rotate Gesture With Inertial Filter “N-Rotate-Inertia”)

This gesture allows for any “n” number of touch points between 2 and 10. The n-rotate-inertia gesture analyzes the motion of the touch point cluster and returns the change in the rotation “dtheta”. Two filters are added to the gesture dimension, a inertial filter and a delta filter.

The inertial filter has the effect of caching the results and then returning values that exponentially decay. These values are then pushed into the delta filter. In the delta filter, when a return value is equal to or below the delta min value (0.01) the return value is set to zero.

The value in the dimension is then mapped to the object rotation in the gesture event update. This has the cumulative effect of “easing” the rotation of the touch object once the matching criteria is broken (touch point number equals zero, one or more than ten).

<Gesture id="n-rotate-inertia" type="rotate">
    <match>
      <action>
          <initial>
              <cluster point_number="0" point_number_min="2" point_number_max="10"/>
          </initial>
      </action>
    </match>
    <analysis>
        <algorithm class="kinemetric" type="continuous">
          <library module="rotate"/>
          <returns>
              <property id="rotate_dtheta" result="dtheta"/>
          </returns>
        </algorithm>
    </analysis>  
    <processing>
        <inertial_filter>
            <property ref="rotate_dtheta" active="true" friction="0.9"/>
        </inertial_filter>
        <delta_filter>
            <property ref="rotate_dtheta" active="true" delta_min="0.01" delta_max="20"/>
        </delta_filter>
    </processing>
    <mapping>
      <update dispatch_type="continuous">
          <gesture_event type="rotate">
              <property ref="rotate_dtheta" target="rotate"/>
          </gesture_event>
      </update>
    </mapping>
</Gesture>
gestures/touch/advanced/gesture-filtering/n-rotate-inertia.txt · Last modified: 2015/09/14 19:34 by glass