User Tools

Site Tools


editing_flick_gesture_acceleration_min_value

Editing Flick Gesture Acceleration Min Value

Cluster max and min

Cluster analysis property thresholds are defined in the “<variables>” tag in the “<analysis>” block. In the example below the var=“etm_ddx” has an allowable min value of var_min=“2”. This sets minimum value of two on the variable “etm_ddx” (mean acceleration in the x direction). If the average group acceleration of the touch point cluster is below 2 pixels per second per second the return value of the dimension is set to zero. If both dimensions are have zero value the gesture will be put in an inactive state and no event will dispatched.

For the “n-flick” When a touch down is recognized on a touch object, the velocity and acceleration of the touch points are tracked. If acceleration of the cluster is above the acceleration threshold a flick event is dispatched with the velocity vectors of the cluster.

<Gesture id="n-flick" type="flick">
<comment>The 'n-flick' gesture can be activated by any number of touch points. When a touch down is recognized on a touch object, the velocity and acceleration of the touch points are tracked. If acceleration of the cluster is above the acceleration threshold a flick event is dispatched.</comment>
    <match>
        <action>
            <initial>
                <cluster point_number="0" point_number_min="1" point_number_max="5"/>
                <event touch_event="touchEnd"/>
            </initial>
        </action>
    </match>
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="flick"/>
            <variables>
                <property id="flick_dx" var="etm_ddx" return="etm_dx" var_min="2"/>
                <property id="flick_dy" var="etm_ddy" return="etm_dy" var_min="2"/>
            </variables>
            <returns>
                <property id="flick_dx" result="etm_dx"/>
                <property id="flick_dy" result="etm_dy"/>
            </returns>
        </algorithm>
    </analysis>    
    <mapping>
        <update dispatch_type="discrete" dispatch_mode="cluster_remove" dispatch_reset="cluster_remove">
            <gesture_event  type="flick">
                <property ref="flick_dx" target=""/>
                <property ref="flick_dy" target=""/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>

Other properties of the cluster can also be assigned limits using this method. For example the “n-scroll” gesture requires the velocities “etm_dx” and “etm_dy” (ensemble temporal mean) have a minimum value of 1 pixel per processing frame. If the cluster is no moving fast enough the gesture will return a null or zero value the a dimension. If both dimensions are zero the gesture will be set in an inactive state (the gesture thread in the pipeline is shut down).

<Gesture id="n-scroll" type="scroll">
    <match>
        <action>
            <initial>
                <cluster point_number="0" point_number_min="0" point_number_max="5"/>
            </initial>
        </action>
    </match>
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="scroll"/>
            <variables>
                <property id="scroll_dx" return="etm_dx" var="etm_dx" var_min="1"/>
                <property id="scroll_dy" return="etm_dy" var="etm_dy" var_min="1"/>
            </variables>
            <returns>
                <property id="scroll_dx" result="etm_dx"/>
                <property id="scroll_dy" result="etm_dy"/>
            </returns>
        </algorithm>
    </analysis>    
    <processing>
        <inertial_filter>
            <property ref="scroll_dx" active="true" friction="0.94"/>
            <property ref="scroll_dy" active="true" friction="0.94"/>
        </inertial_filter>
        <delta_filter>
            <property ref="scroll_dx" active="true" delta_min="0.5" delta_max="30"/>
            <property ref="scroll_dy" active="true" delta_min="0.5" delta_max="30"/>
        </delta_filter>
    </processing>
    <mapping>
        <update dispatch_type="continuous">
            <gesture_event  type="scroll">
                <property ref="scroll_dx" target=""/>
                <property ref="scroll_dy" target=""/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>
editing_flick_gesture_acceleration_min_value.txt · Last modified: 2019/01/29 19:06 (external edit)