flowchart.tex 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. % thanks for the template:
  2. % http://www.texample.net/tikz/examples/simple-flow-chart/
  3. \documentclass{standalone}
  4. \usepackage{gensymb}
  5. %\usepackage[pdftex,active,tightpage]{preview}
  6. %\setlength\PreviewBorder{2mm}
  7. \usepackage[utf8]{inputenc} % this is needed for umlauts
  8. \usepackage[ngerman]{babel} % this is needed for umlauts
  9. \usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
  10. \usepackage{tikz}
  11. \usetikzlibrary{shapes,arrows}
  12. \begin{document}
  13. %\begin{preview}
  14. % Define block styles
  15. \tikzstyle{decision} = [diamond, draw, fill=blue!20,
  16. text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
  17. \tikzstyle{block} = [rectangle, draw, fill=blue!20,
  18. text width=5em, text centered, rounded corners, minimum height=4em]
  19. \tikzstyle{line} = [draw, -latex']
  20. \begin{tikzpicture}[auto]
  21. % Place nodes
  22. \node [block] (init) {start};
  23. \node [decision, below of=init] (boundingBoxes) {do bounding boxes intersect?};
  24. \node [decision, right of=boundingBoxes, node distance=4cm] (lineAIntersectLineB) {does line a intersect line segment b?};
  25. \node [decision, right of=lineAIntersectLineB, node distance=4.7cm] (lineBIntersectLineA) {does line b intersect line segment a?};
  26. \node [block, right of=lineBIntersectLineA, node distance=4.7cm] (yes) {yes};
  27. \node [block, below of=boundingBoxes, node distance=3cm] (no) {no};
  28. % Draw edges
  29. \path [line] (init) -- (boundingBoxes);
  30. \path [line] (boundingBoxes) -- node {no}(no);
  31. \path [line] (boundingBoxes) -- node {yes}(lineAIntersectLineB);
  32. \path [line] (lineAIntersectLineB) |- node {no}(no);
  33. \path [line] (lineAIntersectLineB) -- node {yes}(lineBIntersectLineA);
  34. \path [line] (lineBIntersectLineA) |- node {no}(no);
  35. \path [line] (lineBIntersectLineA) -- node {yes}(yes);
  36. \end{tikzpicture}
  37. %\end{preview}
  38. \end{document}