Last active
October 20, 2020 13:12
-
-
Save LFSaw/be61226873c533c643650ccef1f4721e to your computer and use it in GitHub Desktop.
slider detends by James McCartney
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Slider detends 2020 by James McCartney | |
(https://www.desmos.com/calculator/7txykztr3m) | |
$q$ is the quantisation or detend spacing: | |
$$ | |
q = 0.5 | |
$$ | |
$s \in \[0, 1\]$ is the proportion of slider throw that is in the detented zone. | |
$$ | |
s = 0.2 | |
$$ | |
This is the detent function. | |
It allows for detents spaced at intervals defined by $q$ and of size set by $s$, while maintaining an average slope of $1$. | |
That is, the function passes through every detent position with $y=x.$ | |
\begin{eqnarray} | |
f(x) &=\left( \frac {q} {1-s}\right) \left( a_1 - s \cdot \operatorname{floor}(a_1) -c \right)\\ | |
a_1 &= \frac{x}{q} - \frac{s}{2}\\ | |
a_2 &= \frac{x}{q} + \frac{s}{2}\\ | |
b &= a_2 - \operatorname{floor}(a_2)\\ | |
c &= \{b < s : b, 0 \} | |
\end{eqnarray} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment