TikZ の線とノードの接続

TikZ の線とノードの接続

私の質問は次のとおりです。以下のコードでわかるように、いくつかのノードを配置し、それらを線で接続したいと考えています。しかし、これまでのところ、すべての線を同じポイントで開始/終了させることができませんでした。そのため、常に穴があり、それを回避する方法がわかりません。

    \documentclass{article}
    \usepackage[ngerman]{babel}
    \usepackage{tikz}
    \usetikzlibrary{positioning}
    \begin{document}
    \begin{tikzpicture}
    \node[anchor=center] (1) at (0,5) {};
        \node[above left=1 and 1 of 1.center,anchor=center] (11) {};
        \node[above left =1 and 0.5 of 1.center,anchor=center] (12) {};
        \draw (1) -- (11);
        \draw (1) -- (12);
    \node[anchor=center] (2) at (5,3) {};
        \node[above right=1 and 1 of 2.center,anchor=center] (21) {};
        \node[above right=0.5 and 1 of 2.center,anchor=center] (22) {};
        \draw (2) -- (21);
        \draw (2) -- (22);
    \draw (1) -- (2);
    \end{tikzpicture}
    \end{document}

答え1

より短く、より正確です:

\documentclass{article}
%\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\coordinate (1) at (0,5);
    \draw (1) -- ++ (-1.0,1);
    \draw (1) -- ++ (-0.5,1);
\coordinate (2) at (5,3);
    \node[above right=1 and 1 of 2.center,anchor=center] (21) {};
    \node[above right=0.5 and 1 of 2.center,anchor=center] (22) {};
    \draw (2) -- ++ (1.0,1);
    \draw (2) -- ++ (0.5,1);
\draw (1) -- (2);
\end{tikzpicture}
\end{document}

ここに画像の説明を入力してください

関連情報