User Tools

Site Tools


gestures:touch:advanced:gesture_property_mapping:exponential_mapping

Exponential Mapping

Base 2

The “exp2” function will “multiply” the dimension into a exponential function such that the value of the dimension is raised “two to the power” of the “factor” value. For example this gesture object takes the result of the gesture dimension and multiplies it my two to the power four (2)^4 = 16 so that the value is now a sixteen times larger and in the case of the separation delta will cause the touch object to scale sixteen times faster than without requiring a multiply filter:

<Gesture id="3-point-scale-exponential_b2" type="scale">
    <match>
        <action>
            <initial>
                <cluster point_number="3"/>
            </initial>
        </action>
    </match>
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="scale"/>
            <returns>
                <property id="scale_dsx" result="ds"/>
                <property id="scale_dsy" result="ds"/>
            </returns>
        </algorithm>
    </analysis>
    <processing>
        <multiply_filter>
            <property ref="scale_dsx" active="true" func="exp2" factor="4"/>
            <property ref="scale_dsy" active="true" func="exp2" factor="4"/>
        </multiply_filter>
    </processing>  
    <mapping>
        <update dispatch_type="continuous">
            <gesture_event  type="scale">
                <property ref="scale_dsx" target="scaleX"/>
                <property ref="scale_dsy" target="scaleY"/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>

Base 10

The “exp10” function will “multiply” the dimension into a exponential function such that the value of the dimension is raised “ten to the power” of the “factor” value. For example this gesture object takes the result of the gesture dimension and multiplies it my ten to the power three (one thousand) so that the value is now a thousand times larger and in the case of the separation delta will cause the touch object to scale 1000 times faster than without the multiply filter:

<Gesture id="3-point-scale-exponential_b10" type="scale">
    <match>
        <action>
            <initial>
                <cluster point_number="3"/>
            </initial>
        </action>
    </match>
    <analysis>
        <algorithm class="kinemetric" type="continuous">
            <library module="scale"/>
            <returns>
                <property id="scale_dsx" result="ds"/>
                <property id="scale_dsy" result="ds"/>
            </returns>
        </algorithm>
    </analysis>
    <processing>
        <multiply_filter>
            <property ref="scale_dsx" active="true" func="exp10" factor="3"/>
            <property ref="scale_dsy" active="true" func="exp10" factor="3"/>
        </multiply_filter>
    </processing>  
    <mapping>
        <update dispatch_type="continuous">
            <gesture_event  type="scale">
                <property ref="scale_dsx" target="scaleX"/>
                <property ref="scale_dsy" target="scaleY"/>
            </gesture_event>
        </update>
    </mapping>
</Gesture>

This “3-point-scale-exponential” gesture is great for Zoomable User Interfaces or astronomical interfaces which may require exponentially changing scale values for navigation.

The multiply filter can also multiply the result of a gesture dimension by a non-linear function of the factor. There are four different non linear methods available in the multiply filter:

gestures/touch/advanced/gesture_property_mapping/exponential_mapping.txt · Last modified: 2019/01/29 19:07 (external edit)