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}

여기에 이미지 설명을 입력하세요

관련 정보