Zeichnen zwischen Formen in Tikz

Zeichnen zwischen Formen in Tikz

Ich versuche, Linien vom Mittelkreis (Generalversammlung) zu den Kreisen des Wirtschafts- und Sozialrats und des Internationalen Strafgerichtshofs zu ziehen, sodass der Einfallswinkel der Linie auf allen drei Kreisen 0 Grad beträgt, d. h. die Linie steht in einem 90-Grad-Winkel zur Kreisoberfläche. Im Moment habe ich folgendes Ergebnis.

\documentclass{article}
\usetikzlibrary{calc}
\usetikzlibrary{matrix, shapes}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{snakes}
\usetikzlibrary{positioning, intersections}
\pgfplotsset{compat=1.10}
\begin{document}

    \begin{figure}[H]
    \label{fig:structure}
    \centering
    \begin{tikzpicture}
    \node[xshift=6cm,draw,regular polygon, regular polygon sides=4,text width=3cm,align=center] (sa)
      {{\Large Specialized agencies}:\\
      \textbullet FAO\\
      \textbullet ILO\\
      \textbullet ITU\\
      \textbullet WHO};
      \node[minimum size= 4.5cm, xshift=12cm,draw,circle, text width=3cm,align=center] (ga) {\Large{General Assembly}\\
      \small{1 nation, 1 vote}};
      \node[xshift=12cm,yshift=-5cm,draw, circle, text width=3cm,align=center] (sc) {\Large Security Council\\
      \small{5 permanent members\\
      10 rotating members chosen by GA}};
        \node[xshift=12cm,yshift=5cm,draw,circle, text width=3cm,align=center] (sg) {\Large Secretary General\\
      \small{Supports GA decisions}};
          \node[xshift=17cm,yshift=2cm,draw,circle, text width=3cm,align=center] (ecsoc) {\Large Economic and Social Council
    };
          \node[xshift=17cm,yshift=-2cm,draw,circle, text width=3cm,align=center] (icc) {\Large International Criminal Court
    };
    \draw (sa.east) -- (ga.west);
    \draw (sg.south) -- (ga.north);
    \draw (sc.north) -- (ga.south);
    \draw (ga.east) -- (ecsoc.west);
    \draw (ga.east) -- (icc.west);
    \end{tikzpicture}
    \caption{Structure of the United Nations}
    \end{figure}

\end{document}

Diagramm

Antwort1

Wenn Sie meinen, dass sie senkrecht zum Kreisrand stehen müssen, --verwenden Sie statt edge[out=0, in=180]beispielsweise in \draw (ga.east) edge[out=0, in=180] (ecsoc.west);. Auf diese Weise tritt die Linie bei 0 Grad (rechts) aus und bei 180 Grad (links) ein.

Schreiben Sie außerdem alle Tikz-Bibliotheken an einen Ort, getrennt durch Kommas.nachSie rufen das Tikz-Paket auf, damit es keine Fehler verursacht. Normalerweise liste ich alle Pakete auf, die ich brauche, und dann die Bibliotheken, wenn zutreffend, danach. Auf diese Weise ist es auch leichter zu verstehen und besser organisiert.

Abbildung 1

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\usetikzlibrary{positioning, intersections, calc, matrix, shapes, snakes}
\pgfplotsset{compat=1.10}

\begin{document}

    \begin{figure}[H]
    \label{fig:structure}
    \centering
    \begin{tikzpicture}
    \node[xshift=6cm,draw,regular polygon, regular polygon sides=4,text width=3cm,align=center] (sa)
      {{\Large Specialized agencies}:\\
      \textbullet FAO\\
      \textbullet ILO\\
      \textbullet ITU\\
      \textbullet WHO};
      \node[minimum size= 4.5cm, xshift=12cm,draw,circle, text width=3cm,align=center] (ga) {\Large{General Assembly}\\
      \small{1 nation, 1 vote}};
      \node[xshift=12cm,yshift=-5cm,draw, circle, text width=3cm,align=center] (sc) {\Large Security Council\\
      \small{5 permanent members\\
      10 rotating members chosen by GA}};
        \node[xshift=12cm,yshift=5cm,draw,circle, text width=3cm,align=center] (sg) {\Large Secretary General\\
      \small{Supports GA decisions}};
          \node[xshift=17cm,yshift=2cm,draw,circle, text width=3cm,align=center] (ecsoc) {\Large Economic and Social Council
    };
          \node[xshift=17cm,yshift=-2cm,draw,circle, text width=3cm,align=center] (icc) {\Large International Criminal Court
    };
    \draw (sa.east) -- (ga.west);
    \draw (sg.south) -- (ga.north);
    \draw (sc.north) -- (ga.south);
    \draw (ga.east) edge[out=0, in=180] (ecsoc.west);
    \draw (ga.east) edge[out=0, in=180] (icc.west);
    \end{tikzpicture}
    \caption{Structure of the United Nations}
    \end{figure}

\end{document}

Übrigens kann man das Aussehen der Kurve verändern, indem man den Schlüssel "looseness" hinzufügt. Der Standardwert ist 1, 0 erzeugt eine gerade Linie und steigende Zahlen betonen die Kurve. Hier ist ein Beispiel (der schwarze Wert ist der Standardwert oder 1):

Figur 2

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}

\usetikzlibrary{positioning, intersections, calc, matrix, shapes, snakes}
\pgfplotsset{compat=1.10}

\begin{document}

    \begin{tikzpicture}
    \node[draw, circle, text width=3cm, align=center] (ga) {\Large General Assembly};
    \node[draw, circle, text width=3cm, align=center, xshift=6cm, yshift=3cm] (ecsoc) {\Large Economic and Social Council};

    \draw[green] (ga.east) edge[out=0, in=180, looseness=0] (ecsoc.west);
    \draw (ga.east) edge[out=0, in=180, looseness=1] (ecsoc.west);
    \draw[red] (ga.east) edge[out=0, in=180, looseness=5] (ecsoc.west);
    \draw[blue] (ga.east) edge[out=0, in=180, looseness=10] (ecsoc.west);

    \end{tikzpicture}

\end{document}

verwandte Informationen