User Tools

Site Tools


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

N-Scale-Inertia

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

This gesture allows for any “n” number of touch points between 2 and 10. The n-scale-inertia gesture analyzes the motion of the touch point cluster and returns the change in the separation in x and y direction “dsx” and “dsy”. Two filters are added to each 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 decays. 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 values in each dimension are then mapped to scaleX and scaleY in the gesture event update. This has the cumulative effect of “easing” the scaling 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="2"/>
      </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-scale-inertia.txt · Last modified: 2019/01/29 19:07 (external edit)