diagrams.tex 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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\examplefigureone{
  192. \begin{figure}[h]
  193. \center
  194. % TODO: draw finger touch points as circles with rotating arrow
  195. \begin{tikzpicture}
  196. \draw node[draw, black, minimum width=190, minimum height=140] at (0,0) {};
  197. \draw node[fill=gray!50, draw=black!70, minimum height=40, minimum width=40] at (-1,-1) {};
  198. \draw node[draw=black!80, diamond, minimum height=50, minimum width=50] at (1.2,1) {};
  199. \end{tikzpicture}
  200. \caption{Two squares on the screen both listen to rotation. The user
  201. should be able to ``grab'' each of the squares independently and rotate
  202. them at the same time.}
  203. \label{fig:ex1}
  204. \end{figure}
  205. }
  206. \def\examplefiguretwo{
  207. \begin{figure}[h]
  208. \center
  209. \begin{tikzpicture}
  210. \draw node[draw, black, minimum width=190, minimum height=140] at (0,0) {};
  211. \draw node[draw=black!80, diamond, minimum height=50, minimum width=50] at (0.5, 0.3) {};
  212. \draw node[draw=black, diamond, dotted, minimum height=53, minimum width=53] at (0.5, 0.3) {};
  213. \draw node[draw=black, dotted, circle, minimum height=80, minimum width=80] at (0.5, 0.3) {};
  214. \fill (-0.3, -0.4) circle (0.15)
  215. (-0.4, 0.8) circle (0.15)
  216. (-0.1, 1.1) circle (0.15)
  217. (1.3, 0.9) circle (0.15);
  218. \draw (0.15, 0.55) circle (0.15) -- (-0.3, -0.4);
  219. \draw (0.15, 0.55) -- (-0.4, 0.8);
  220. \draw (0.15, 0.55) -- (-0.1, 1.1);
  221. \draw (0.15, 0.55) -- (1.3, 0.9);
  222. \end{tikzpicture}
  223. \caption{A square on the screen listens to rotation. The user can grab
  224. and rotate the square by positioning fingers around (but not in) it and
  225. and performing a rotating motion. An example pose of four fingers is
  226. shown by the filled black circles. While the events all occur in the
  227. dotted \emph{area}, the centroid of the rotation gesture is located in
  228. the square.}
  229. \label{fig:ex2}
  230. \end{figure}
  231. }
  232. \def\eventpropagationfigure{
  233. \begin{figure}[h!]
  234. \center
  235. \vspace{-2em}
  236. \subfigure[An event is triggered in the white area. The event is first
  237. delegated to the white area from te gray area (2). After gesture
  238. detection, it is propagated back to the gray area (6) \emph{unless}
  239. propagation has been stopped in the gesture tracker between (3) and (4).]{
  240. \begin{tikzpicture}[node distance=5.5em]
  241. \draw node[draw=black, minimum width=190, minimum height=140] (screen) at (0,0) {};
  242. \draw node[fill=gray!50, draw=black!70, minimum height=100, minimum width=100] (screen) at (-0.1,-0.1) {};
  243. \draw node[fill=white, draw=black!80, diamond, minimum height=50, minimum width=50] (screen) at (0.3,0.4) {};
  244. \fill (0.4, 0.6) circle (0.15);
  245. \draw node[block, yshift=-10em, xshift=-3em] (driver) {Event driver};
  246. \draw node[block, below of=driver] (gray) {Gray area}
  247. edge[linefrom] node[left] {1} (driver);
  248. \draw node[block, below of=gray] (white) {White area}
  249. edge[linefrom, bend left=15] node[left] {2} (gray)
  250. edge[lineto, bend right=15] node[right] {6} (gray);
  251. \draw node[block, right of=white, xshift=4em] {\emph{rotation} tracker}
  252. edge[linefrom, bend right=15] node[above] {3} (white)
  253. edge[lineto, dotted, bend left=15] node[below] {4} (white);
  254. \draw node[block, right of=gray, xshift=4em] {\emph{rotation} tracker}
  255. edge[linefrom, bend right=15] node[above] {7} (gray)
  256. edge[lineto, dotted, bend left=15] node[below] {8} (gray);
  257. \draw node[block, below of=white] {Application}
  258. edge[linefrom, dotted, bend left=65] node[left] {9} (gray)
  259. edge[linefrom, dotted] node[left] {5} (white);
  260. \end{tikzpicture}
  261. }
  262. \quad
  263. \subfigure[An event is triggered in the gray area, it does not even
  264. reach the white area.]{
  265. \begin{tikzpicture}[node distance=5.5em]
  266. \draw node[draw=black, minimum width=190, minimum height=140] (screen) at (0,0) {};
  267. \draw node[fill=gray!50, draw=black!70, minimum height=100, minimum width=100] (screen) at (-0.1,-0.1) {};
  268. \draw node[fill=white, draw=black!80, diamond, minimum height=50, minimum width=50] (screen) at (0.3,0.4) {};
  269. \fill (-0.5, -0.7) circle (0.15);
  270. \draw node[block, yshift=-10em, xshift=-3em] (driver) {Event driver};
  271. \draw node[block, below of=driver] (gray) {Gray area}
  272. edge[linefrom] node[left] {1} (driver);
  273. \draw node[block, below of=gray] (white) {White area};
  274. \draw node[block, right of=white, xshift=4em] {\emph{rotation} tracker};
  275. \draw node[block, right of=gray, xshift=4em] {\emph{rotation} tracker}
  276. edge[linefrom, bend right=15] node[above] {2} (gray)
  277. edge[lineto, dotted, bend left=15] node[below] {3} (gray);
  278. \draw node[block, below of=white] {Application}
  279. edge[linefrom, dotted, bend left=65] node[left] {4} (gray);
  280. \end{tikzpicture}
  281. }
  282. \caption{Two nested squares both listen to rotation gestures. The two
  283. figures both show a touch object triggering an event, which is
  284. delegated through the area tree in the order indicated by the numbered
  285. arrow labels. Normal arrows represent events, dotted arrows represent
  286. gestures. Note that the dotted arrows only represent the path a gesture
  287. would travel in the tree \emph{if triggered}, not an actual triggered
  288. gesture.}
  289. \label{fig:eventpropagation}
  290. \end{figure}
  291. }
  292. \def\daemondiagram{
  293. \begin{figure}[h!]
  294. \centering
  295. \begin{tikzpicture}[node distance=4em]
  296. \node[block] (daemon) {Daemon};
  297. \node[block, above of=daemon] (driver) {Device driver}
  298. edge[lineto] (daemon);
  299. \node[block, xshift=-4em, left of=driver] {Device driver}
  300. edge[lineto] (daemon);
  301. \node[block, xshift=4em, right of=driver] {Device driver}
  302. edge[lineto] (daemon);
  303. \node[block, below of=daemon] (app) {Application}
  304. edge[linefrom, dotted] (daemon);
  305. \node[block, xshift=-4em, left of=app] {Application}
  306. edge[linefrom, dotted] (daemon);
  307. \node[block, xshift=4em, right of=app] {Application}
  308. edge[linefrom, dotted] (daemon);
  309. \draw[dashed] (app.north)+(-4, 0.35) -- node[right=4, yshift=1] {Network protocol} ++(4, 0.35);
  310. \end{tikzpicture}
  311. \caption{Daemon setup of an architecture implementation, serving
  312. gestures to multiple applications at the same time.}
  313. \label{fig:daemon}
  314. \end{figure}
  315. }