diagrams.tex 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. % Define node group background
  2. % The first 4 arguments are nodes that define the group borders in (left,
  3. % top, right, bottom) order, the last argument is a text label
  4. \usetikzlibrary{shapes,arrows,positioning}
  5. \pgfdeclarelayer{background}
  6. \pgfdeclarelayer{foreground}
  7. \pgfsetlayers{background,main,foreground} % Layer order
  8. \newcommand{\group}[5]{
  9. \begin{pgfonlayer}{background}
  10. % Left top corner
  11. \path (#1.west |- #2.north)+(-0.7, 0.7)
  12. node (lefttop) {};
  13. % Right bottom corner
  14. \path (#3.east |- #4.south)+(0.7, -0.4)
  15. node (rightbottom) {};
  16. % Draw rectangle
  17. \path[draw, rounded corners, dashed] (lefttop) rectangle (rightbottom);
  18. % Text label
  19. \path (rightbottom.west |- lefttop.south)+(-1.2, -0.3) node {\emph{#5}};
  20. \end{pgfonlayer}
  21. }
  22. \tikzstyle{block} = [
  23. rectangle,
  24. draw=black,
  25. fill=white,
  26. thick,
  27. minimum height=2em,
  28. text centered,
  29. rounded corners,
  30. text width=6em
  31. ]
  32. \tikzstyle{lineto} = [
  33. ->,
  34. thick,
  35. shorten <= 2pt,
  36. shorten >= 2pt
  37. ]
  38. \tikzstyle{linefrom} = [
  39. <-,
  40. thick,
  41. shorten <= 2pt,
  42. shorten >= 2pt
  43. ]
  44. \newcommand{\architecture}[1]{
  45. \begin{tikzpicture}[node distance=6em, auto]
  46. \node[block] (driver) {Driver};
  47. #1
  48. \end{tikzpicture}
  49. }
  50. \def\basicdiagram{
  51. \begin{figure}[h]
  52. \center
  53. \architecture{
  54. \node[block, dashed, below of=driver] (arch) {Architecture}
  55. edge[linefrom] node[right] {driver-specific messages} (driver);
  56. \node[block, below of=arch] {Application}
  57. edge[linefrom] node[right] {gestures} (arch);
  58. }
  59. \caption{A diagram showing the position of the architecture relative to
  60. the device driver and a multi-touch application. The input of the
  61. architecture is given by a touch device driver. The output is
  62. translated to complex interaction gestures and passed to the
  63. application that is using the architecture.}
  64. \label{fig:basicdiagram}
  65. \end{figure}
  66. }
  67. \def\driverdiagram{
  68. \begin{figure}[H]
  69. \center
  70. \architecture{
  71. \node[block, below of=driver] (eventdriver) {Event driver}
  72. edge[linefrom] node[right, near end] {driver-specific messages} (driver);
  73. \node[block, below of=eventdriver, dashed] (analysis) {Event analysis}
  74. edge[linefrom] node[right] {events} (eventdriver);
  75. \node[block, below of=analysis] {Application}
  76. edge[linefrom] node[right, near start] {gestures} (analysis);
  77. \node[right of=eventdriver, xshift=2em] (dummy) {};
  78. \group{eventdriver}{eventdriver}{dummy}{analysis}{Architecture}
  79. }
  80. \caption{Extension of the diagram from figure \ref{fig:basicdiagram},
  81. showing the position of the event driver in the architecture. The
  82. event driver translates driver-specific to a common set of events,
  83. which are delegated to analysis components that will interpret them
  84. as more complex gestures.}
  85. \label{fig:driverdiagram}
  86. \end{figure}
  87. }
  88. \def\multipledriversdiagram{
  89. \begin{figure}[H]
  90. \center
  91. \begin{tikzpicture}[node distance=6em]
  92. \node[block] (driver) {Driver};
  93. \node[block, below of=driver] (eventdriver) {Event driver}
  94. edge[linefrom] (driver);
  95. \node[block, right of=driver, xshift=2em] (seconddriver) {Driver};
  96. \node[block, below of=seconddriver] (secondeventdriver) {Event driver}
  97. edge[linefrom] node[right, near end] {driver-specific messages} (seconddriver);
  98. \node[block, below of=eventdriver, dashed] (analysis) {Event analysis}
  99. edge[linefrom] (eventdriver)
  100. edge[linefrom] node[right=5] {events} (secondeventdriver);
  101. \node[block, below of=analysis] {Application}
  102. edge[linefrom] node[right, near start] {gestures} (analysis);
  103. \node[right of=seconddriver, xshift=2em] (dummy) {};
  104. \group{eventdriver}{eventdriver}{dummy}{analysis}{Architecture}
  105. \end{tikzpicture}
  106. \caption{Multiple event drivers running simultaneously.}
  107. \label{fig:multipledrivers}
  108. \end{figure}
  109. }
  110. \def\areadiagram{
  111. \begin{figure}[h]
  112. \center
  113. \architecture{
  114. \node[block, below of=driver] (eventdriver) {Event driver}
  115. edge[linefrom] node[right, near end] {driver-specific messages} (driver);
  116. \node[block, below of=eventdriver] (area) {Areas}
  117. edge[linefrom] node[right] {events} (eventdriver);
  118. \node[block, right of=area, xshift=7em, dashed] (analysis) {Gesture detection}
  119. edge[linefrom, bend right=10] node[above] {events} (area)
  120. edge[lineto, bend left=10] node[] {gestures} (area);
  121. \node[block, below of=area] {Application}
  122. edge[linefrom] node[right, near start] {gestures} (area);
  123. \group{eventdriver}{eventdriver}{analysis}{area}{Architecture}
  124. }
  125. \caption{Extension of the diagram from figure \ref{fig:driverdiagram},
  126. showing the position of areas in the architecture. An area delegate
  127. events to a gesture detection component that trigger gestures. The area
  128. then calls the handler that is bound to the gesture type by the
  129. application.}
  130. \label{fig:areadiagram}
  131. \end{figure}
  132. }
  133. \def\trackerdiagram{
  134. \begin{figure}[h]
  135. \center
  136. \architecture{
  137. \node[block, below of=driver] (eventdriver) {Event driver}
  138. edge[linefrom] node[right, near end] {driver-specific messages} (driver);
  139. \node[block, below of=eventdriver] (area) {Area tree}
  140. edge[linefrom] node[right] {events} (eventdriver);
  141. \node[block, right of=area, xshift=7em] (tracker) {Gesture trackers}
  142. edge[linefrom, bend right=10] node[above] {events} (area)
  143. edge[lineto, bend left=10] node[] {gestures} (area);
  144. \node[block, below of=area] {Application}
  145. edge[linefrom] node[right, near start] {gestures} (area);
  146. \group{eventdriver}{eventdriver}{tracker}{area}{Architecture}
  147. }
  148. \caption{Extension of the diagram from figure \ref{fig:areadiagram},
  149. showing the position of gesture trackers in the architecture.}
  150. \label{fig:trackerdiagram}
  151. \end{figure}
  152. }
  153. \def\examplediagram{
  154. \begin{figure}[h!]
  155. \center
  156. \architecture{
  157. \node[block, below of=driver] (eventdriver) {Event driver}
  158. edge[linefrom] node[right, near end] {driver-specific messages} (driver);
  159. \node[block, below of=eventdriver] (rootarea) {Root area}
  160. edge[linefrom] (eventdriver);
  161. \node[block, right of=rootarea, xshift=4em] {\emph{pinch} tracker}
  162. edge[lineto, dotted, bend left=10] (rootarea)
  163. edge[linefrom, bend right=10] (rootarea);
  164. \node[block, below of=rootarea, xshift=-5em] (circlearea) {Circular area}
  165. edge[linefrom] (rootarea)
  166. edge[lineto, bend left=25] (rootarea);
  167. \node[block, left of=circlearea, xshift=-4em] (dragtracker) {\emph{drag} tracker}
  168. edge[lineto, dotted, bend right=10] (circlearea)
  169. edge[linefrom, bend left=10] (circlearea);
  170. \node[block, below of=rootarea, xshift=5em] (subarea) {Button area}
  171. edge[linefrom] (rootarea)
  172. edge[lineto, bend right=25] (rootarea);
  173. \node[block, right of=subarea, xshift=4em] (tracker) {\emph{tap} tracker}
  174. edge[lineto, dotted, bend left=10] (subarea)
  175. edge[linefrom, bend right=10] (subarea);
  176. \node[block, below of=rootarea, yshift=-5em] {Application}
  177. edge[linefrom, dotted] (circlearea)
  178. edge[linefrom, dotted] (rootarea)
  179. edge[linefrom, dotted] (subarea);
  180. \group{dragtracker}{eventdriver}{tracker}{subarea}{Architecture}
  181. }
  182. \caption{Diagram representation of an extended example, showing the
  183. flow of events and gestures in the architecture. The root area represents
  184. an application windows that can be resized using \emph{pinch} gestures.
  185. The window contains a draggable circle, and a button that listens to
  186. \emph{tap} gestures. Dotted arrows represent a flow of gestures, regular
  187. arrows represent events (unless labeled otherwise).}
  188. \label{fig:examplediagram}
  189. \end{figure}
  190. }
  191. \def\lefthand{\includegraphics[width=50pt]{data/hand.png}}
  192. \def\righthand{\reflectbox{\includegraphics[width=50pt, angle=-45]{data/hand.png}}}
  193. \def\examplefigureone{
  194. \begin{figure}[h]
  195. \center
  196. % TODO: draw finger touch points as circles with rotating arrow
  197. \begin{tikzpicture}
  198. \draw node[draw, black, minimum width=190, minimum height=140] at (0,0) {};
  199. \draw node[fill=gray!50, draw=black!70, minimum height=40, minimum width=40] at (-1,-1) {\lefthand};
  200. \draw node[] at (1.2,1) {\righthand};
  201. \draw node[draw=black!80, diamond, minimum height=70, minimum width=70] at (1.2,1) {};
  202. \end{tikzpicture}
  203. \caption{Two squares on the screen both listen to rotation. The user
  204. should be able to ``grab'' each of the squares independently and rotate
  205. them at the same time.}
  206. \label{fig:ex1}
  207. \end{figure}
  208. }
  209. \def\examplefiguretwo{
  210. \begin{figure}[h]
  211. \center
  212. \begin{tikzpicture}
  213. \draw node[draw, black, minimum width=190, minimum height=140] at (0,0) {};
  214. \draw node[draw=black!80, diamond, minimum height=50, minimum width=50] at (0.5, 0.3) {};
  215. \draw node[draw=black, diamond, dotted, minimum height=53, minimum width=53] at (0.5, 0.3) {};
  216. \draw node[draw=black, dotted, circle, minimum height=80, minimum width=80] at (0.5, 0.3) {};
  217. \fill (-0.3, -0.4) circle (0.15)
  218. (-0.4, 0.8) circle (0.15)
  219. (-0.1, 1.1) circle (0.15)
  220. (1.3, 0.9) circle (0.15);
  221. \draw (0.15, 0.55) circle (0.15) -- (-0.3, -0.4);
  222. \draw (0.15, 0.55) -- (-0.4, 0.8);
  223. \draw (0.15, 0.55) -- (-0.1, 1.1);
  224. \draw (0.15, 0.55) -- (1.3, 0.9);
  225. \end{tikzpicture}
  226. \caption{A square on the screen listens to rotation. The user can grab
  227. and rotate the square by positioning fingers around (but not in) it and
  228. and performing a rotating motion. An example pose of four fingers is
  229. shown by the filled black circles. While the events all occur in the
  230. dotted \emph{area}, the centroid of the rotation gesture is located in
  231. the square.}
  232. \label{fig:ex2}
  233. \end{figure}
  234. }
  235. \def\eventpropagationfigure{
  236. \begin{figure}[h!]
  237. \center
  238. \vspace{-2em}
  239. \subfigure[An event is triggered in the white area. The event is first
  240. delegated to the white area from te gray area (2). After gesture
  241. detection, it is propagated back to the gray area (6) \emph{unless}
  242. propagation has been stopped in the gesture tracker between (3) and (4).]{
  243. \begin{tikzpicture}[node distance=5.5em]
  244. \draw node[draw=black, minimum width=190, minimum height=140] (screen) at (0,0) {};
  245. \draw node[fill=gray!50, draw=black!70, minimum height=100, minimum width=100] (screen) at (-0.1,-0.1) {};
  246. \draw node[fill=white, draw=black!80, diamond, minimum height=50, minimum width=50] (screen) at (0.3,0.4) {};
  247. \fill (0.4, 0.6) circle (0.15);
  248. \draw node[block, yshift=-10em, xshift=-3em] (driver) {Event driver};
  249. \draw node[block, below of=driver] (gray) {Gray area}
  250. edge[linefrom] node[left] {1} (driver);
  251. \draw node[block, below of=gray] (white) {White area}
  252. edge[linefrom, bend left=15] node[left] {2} (gray)
  253. edge[lineto, bend right=15] node[right] {6} (gray);
  254. \draw node[block, right of=white, xshift=4em] {\emph{rotation} tracker}
  255. edge[linefrom, bend right=15] node[above] {3} (white)
  256. edge[lineto, dotted, bend left=15] node[below] {4} (white);
  257. \draw node[block, right of=gray, xshift=4em] {\emph{rotation} tracker}
  258. edge[linefrom, bend right=15] node[above] {7} (gray)
  259. edge[lineto, dotted, bend left=15] node[below] {8} (gray);
  260. \draw node[block, below of=white] {Application}
  261. edge[linefrom, dotted, bend left=65] node[left] {9} (gray)
  262. edge[linefrom, dotted] node[left] {5} (white);
  263. \end{tikzpicture}
  264. }
  265. \quad
  266. \subfigure[An event is triggered in the gray area, it does not even
  267. reach the white area.]{
  268. \begin{tikzpicture}[node distance=5.5em]
  269. \draw node[draw=black, minimum width=190, minimum height=140] (screen) at (0,0) {};
  270. \draw node[fill=gray!50, draw=black!70, minimum height=100, minimum width=100] (screen) at (-0.1,-0.1) {};
  271. \draw node[fill=white, draw=black!80, diamond, minimum height=50, minimum width=50] (screen) at (0.3,0.4) {};
  272. \fill (-0.5, -0.7) circle (0.15);
  273. \draw node[block, yshift=-10em, xshift=-3em] (driver) {Event driver};
  274. \draw node[block, below of=driver] (gray) {Gray area}
  275. edge[linefrom] node[left] {1} (driver);
  276. \draw node[block, below of=gray] (white) {White area};
  277. \draw node[block, right of=white, xshift=4em] {\emph{rotation} tracker};
  278. \draw node[block, right of=gray, xshift=4em] {\emph{rotation} tracker}
  279. edge[linefrom, bend right=15] node[above] {2} (gray)
  280. edge[lineto, dotted, bend left=15] node[below] {3} (gray);
  281. \draw node[block, below of=white] {Application}
  282. edge[linefrom, dotted, bend left=65] node[left] {4} (gray);
  283. \end{tikzpicture}
  284. }
  285. \caption{Two nested squares both listen to rotation gestures. The two
  286. figures both show a touch object triggering an event, which is
  287. delegated through the area tree in the order indicated by the numbered
  288. arrow labels. Normal arrows represent events, dotted arrows represent
  289. gestures. Note that the dotted arrows only represent the path a gesture
  290. would travel in the tree \emph{if triggered}, not an actual triggered
  291. gesture.}
  292. \label{fig:eventpropagation}
  293. \end{figure}
  294. }
  295. \def\daemondiagram{
  296. \begin{figure}[h!]
  297. \centering
  298. \begin{tikzpicture}[node distance=4em]
  299. \node[block] (daemon) {Daemon};
  300. \node[block, above of=daemon] (driver) {Device driver}
  301. edge[lineto] (daemon);
  302. \node[block, xshift=-4em, left of=driver] {Device driver}
  303. edge[lineto] (daemon);
  304. \node[block, xshift=4em, right of=driver] {Device driver}
  305. edge[lineto] (daemon);
  306. \node[block, below of=daemon] (app) {Application}
  307. edge[linefrom, dotted] (daemon);
  308. \node[block, xshift=-4em, left of=app] {Application}
  309. edge[linefrom, dotted] (daemon);
  310. \node[block, xshift=4em, right of=app] {Application}
  311. edge[linefrom, dotted] (daemon);
  312. \draw[dashed] (app.north)+(-4, 0.35) -- node[right=4, yshift=1] {Network protocol} ++(4, 0.35);
  313. \end{tikzpicture}
  314. \caption{Daemon setup of an architecture implementation, serving
  315. gestures to multiple applications at the same time.}
  316. \label{fig:daemon}
  317. \end{figure}
  318. }