diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-05-14 01:15:14 +0200 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-05-14 01:41:39 +0200 |
| commit | 8ced3667a30e00bd2368d4b5417f1f07cc86d290 (patch) | |
| tree | 57137593f90a29c5ac9039fc1aebcde1158f01cb /src/mtstate.h | |
| parent | ebaf307ab1b22d4786cc5fb55170204759e887ce (diff) | |
Add convenience methods for distance to capability center point
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/mtstate.h')
| -rw-r--r-- | src/mtstate.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mtstate.h b/src/mtstate.h index fa297cd..a8feaa4 100644 --- a/src/mtstate.h +++ b/src/mtstate.h | |||
| @@ -44,5 +44,19 @@ void output_mtstate(const struct MTState *s); | |||
| 44 | 44 | ||
| 45 | const struct MTFinger *find_finger(const struct MTState *s, int id); | 45 | const struct MTFinger *find_finger(const struct MTState *s, int id); |
| 46 | 46 | ||
| 47 | |||
| 48 | static inline int center_dist2(const struct MTFinger *a, | ||
| 49 | const struct Capabilities *caps) | ||
| 50 | { | ||
| 51 | return dist2(a->hw.position_x - get_cap_xmid(caps), | ||
| 52 | a->hw.position_y - get_cap_ymid(caps)); | ||
| 53 | } | ||
| 54 | |||
| 55 | static inline int center_maxdist2(const struct Capabilities *caps) | ||
| 56 | { | ||
| 57 | return dist2(caps->abs_position_x.maximum - get_cap_xmid(caps), | ||
| 58 | caps->abs_position_y.maximum - get_cap_ymid(caps)); | ||
| 59 | } | ||
| 60 | |||
| 47 | #endif | 61 | #endif |
| 48 | 62 | ||
