Generalized linear gesture detector