diff options
Diffstat (limited to 'src/grail-gestures.c')
| -rw-r--r-- | src/grail-gestures.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/grail-gestures.c b/src/grail-gestures.c index 1d49765..be53cc0 100644 --- a/src/grail-gestures.c +++ b/src/grail-gestures.c | |||
| @@ -69,7 +69,7 @@ static float compute_rotation(float x, float y, float r, | |||
| 69 | const struct touch_frame *frame) | 69 | const struct touch_frame *frame) |
| 70 | { | 70 | { |
| 71 | int i, n = frame->nactive; | 71 | int i, n = frame->nactive; |
| 72 | float da = 0, da2 = 0; | 72 | float da = 0, darc2 = 0; |
| 73 | if (n < 2) | 73 | if (n < 2) |
| 74 | return da; | 74 | return da; |
| 75 | for (i = 0; i < n; i++) { | 75 | for (i = 0; i < n; i++) { |
| @@ -79,10 +79,10 @@ static float compute_rotation(float x, float y, float r, | |||
| 79 | float dy = t->prop[TP_POS_Y] - y; | 79 | float dy = t->prop[TP_POS_Y] - y; |
| 80 | float mx = t->prop[TP_POS_X] - ot->prop[TP_POS_X]; | 80 | float mx = t->prop[TP_POS_X] - ot->prop[TP_POS_X]; |
| 81 | float my = t->prop[TP_POS_Y] - ot->prop[TP_POS_Y]; | 81 | float my = t->prop[TP_POS_Y] - ot->prop[TP_POS_Y]; |
| 82 | da2 += dx * my - dy * mx; | 82 | darc2 += dx * my - dy * mx; |
| 83 | } | 83 | } |
| 84 | da2 /= n; | 84 | darc2 /= n; |
| 85 | da = da2 / r; | 85 | da = darc2 / (r * r); |
| 86 | return da; | 86 | return da; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| @@ -150,7 +150,7 @@ void gru_init_motion(struct grail *ge) | |||
| 150 | D[FM_X] = max.x - min.x; | 150 | D[FM_X] = max.x - min.x; |
| 151 | D[FM_Y] = max.y - min.y; | 151 | D[FM_Y] = max.y - min.y; |
| 152 | D[FM_R] = sqrt(D[FM_X] * D[FM_X] + D[FM_Y] * D[FM_Y]); | 152 | D[FM_R] = sqrt(D[FM_X] * D[FM_X] + D[FM_Y] * D[FM_Y]); |
| 153 | D[FM_A] = D[FM_R]; | 153 | D[FM_A] = 2 * M_PI; |
| 154 | for (i = 0; i < DIM_FM; i++) { | 154 | for (i = 0; i < DIM_FM; i++) { |
| 155 | m->fm[i].fuzz = D[i] / FM_SN[i]; | 155 | m->fm[i].fuzz = D[i] / FM_SN[i]; |
| 156 | m->fm[i].bar = D[i] / FM_BAR[i]; | 156 | m->fm[i].bar = D[i] / FM_BAR[i]; |
