Skip to content

Instantly share code, notes, and snippets.

@whot
Created July 7, 2014 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whot/c9e66f368a1b895d9c22 to your computer and use it in GitHub Desktop.
Save whot/c9e66f368a1b895d9c22 to your computer and use it in GitHub Desktop.
#!/usr/bin/gnuplot
# soften_delta function from libinput/src/filter.c.
#
# static double
# soften_delta(double last_delta, double delta)
# {
# if (delta < -1.0 || delta > 1.0) {
# if (delta > last_delta)
# return delta - 0.5;
# else if (delta < last_delta)
# return delta + 0.5;
# }
# return delta;
# }
sd(dx, dx_old) = (abs(dx) < 1.0) ? dx : \
(dx > dx_old) ? dx - 0.5 : \
(dx < dx_old) ? dx + 0.5 : \
dx
set xrange [-3:3]
set yrange [-3:3]
set isosamples 20
splot sd(x, y) with points
pause -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment