Skip to content

Custom Functions

Géry Casiez edited this page Feb 6, 2017 · 7 revisions

Tune your transfer function or build it from scratch.

There are three ways to use a custom transfer function:

  • Use existing TransferFunctions.
  • Build Interpolated Transfer Function and use interp: scheme.
  • Subclass TransferFunction

The first two methods are covered in this page. The third one can be used in case if you really need to have something very custom.

Existing custom transfer functions

interp

The transfer function which uses a given table to produce output values and interpolates for missing values. URI to use it: interp:/dirname?f=acc&normalize=false, where dirname is the path to the directory which contains data, f defines the acceleration setting to use, normalize defines whether input and output device resolutions should be taken into account while computing a transfer function.

If you want to interpolate defined points in velocity-velocity space, you can specify space=vv in the query of the input device URI. If this argument is not given, it is implicitly initialized with space=vg (interpolation is done in velocity-gain space).

naive

Naive constant CD gain, i.e. pixels = gain * mickeys. Example URI: naive:?cdgain=1

constant

Resolution-aware constant CD gain. Example URI: constant:?cdgain=4&nosubpix=false

composition

Composes the functions described in filename of URI (composition:<filename>): one function per line, called in appearing order, i.e. pixels = fn(...f2(f1(mickeys)))

sigmoid

Sigmoid function, which defines minimum gain corresponding to minimum velocity and maximum gain corresponding to maximum velocity. Example URI: sigmoid:?gmin=1&v1=0.05&v2=0.2&gmax=6&nosubpix=false, where gmin is minimum gain applied when velocity <= v1, gmax is maximum gain when velocity >= v2. The gain is interpolated between gmin and gmax, if the input velocity is between v1 and v2.

Sigmoid transfer function

Build your custom function

In order to build your custom function you need to create files with a specific format and use interp scheme to interpret them.

All the created files must be in the same folder. The folder must contain config.dict file which describes the main parameters of the function and acceleration schemes and .dat - files which contain a table of values to interpolate.

functionfolder/
	config.dict
	f1.dat
	f2.dat
	...
	fn.dat

config.dict file must look something like this:

system: System_name

libpointing-input: dummy:?hz=125&cpi=400

libpointing-output: dummy:?bx=0&by=0&bw=1680&bh=1050&w=330.791&h=206.744&hz=60

functions: f1,f2,f3
function-aliases: 0,0.25,1

default-function: f2

Where libpointing-input and libpointing-output are required if you want to build a resolution aware transfer function. If not, direct mapping of counts and pixels will be used.

functions is the list of acceleration profiles of this function. Also, it is used to find .dat-files inside the folder. function-aliases are used to define the meaningful names for the acceleration profiles and default-function is used by default if no function is specified in the uri.

Each .dat-file must look as follows:

max-counts: n

0: 0
1: any number like (0.789)
2: any number
...
n: any number

n is the number of counts mapped onto pixels taking into account the device information in the config.dict. You can skip some of the values, interpolation will be used to estimate them.

Examples can be found here.

system

The system: URI uses the current system's transfer function with its current settings.

On Windows system:?slider=XX&epp=YY changes the system's transfer function with the slider position defined by slider arg; 0 being the default position and is in the range [-5, 5]. epp arg [true, false] defines if enhance pointer precision is enabled. Note that the "Pointer Options" tab in "Mouse Properties" won't upate the slider position and check box state until rebooting. The changes are still correctly applied to the mouse pointer.

On Linux system:?num=XX&den=YY&thr=ZZ changes the system's transfer function with the acceleration value (expressed as a fraction) and the threshold for the system

On macOS system:?setting=XX changes the system's transfer function where setting is a double as defined here