tikzpicture에서 루트 노드를 가로지르는 선

tikzpicture에서 루트 노드를 가로지르는 선

약간의 문제가 있습니다. 루트 노드를 가로지르는 선이 있습니다. 어떻게 고치나요?

\tikzset{
        basic/.style  = {draw, text width=1.5cm, drop shadow, font=\sffamily, rectangle},
        root/.style   = {basic, rounded corners=6pt, thin, align=center,
            fill=green!60, text width=13cm},
        level 2/.style = {basic, rounded corners=4pt, thin,align=center, fill=green!60,
            text width=8em},
        level 3/.style = {basic, thin, align=left, fill=pink!60, text width=8em, align=center}
    }
    \hspace*{0cm}{
        \begin{tikzpicture}[
        level 1/.style={sibling distance=70mm},
        edge from parent/.style={->,draw},
        >=latex]

        \begin{scope}[every node/.style={level 3}]

        \node[root] (c1) {AAAAA};

        \node [below of = c1, xshift=-4cm, yshift=0cm] (c11) {S};
        \node [below of = c11] (c12) {D};
        \node [below of = c12] (c13) {R};

        \node [below of = c1, xshift=4cm, yshift=.15cm] (c14) {W};
        \node [below of = c14, yshift=-0.5cm] (c15) {K};
        \node [below of = c15, yshift=-0.5cm] (c16) {M};
        \end{scope}

        \foreach \value in {1,2,3}
        \draw[->] (c1.120) |- (c1\value.east);

        \foreach \value in {4,5,6}
        \draw[->] (c1.270) |- (c1\value.west);
        \end{tikzpicture}}

답변1

구문은 노드의 경계와 노드의 중심에서 120도 각도를 이루는 선의 c1.120교차점을 의미합니다 . c1귀하의 경우 이 지점은 상단 경계에 있으며 \draw[->] (c1.120) |- (c1\value.east);노드를 교차합니다. 이 구문을 준수하려면 와 같이 아래쪽 테두리에 시작점을 배치하는 각도를 선택하면 됩니다 c1.250.

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

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
\node[draw, minimum width=2cm, minimum height=1cm] (c1) {};

\node[draw, minimum width=2cm, minimum height=1cm, below left= 0.5cm and 0.5cm of c1] (c2) {};

\draw (c1.center) -- (120:2cm);
\draw (c1.center) -- (0:2cm);
\draw (0:1.5cm) arc [start angle=0, end angle=120, radius=1.5cm] node[midway, above right] {$120^\circ$};
\draw[fill=red] (c1.120) circle (2pt);
\draw (c1.120) |- (c2);

\begin{scope}[xshift=5cm]
\node[draw, minimum width=2cm, minimum height=1cm] (c1) {};
\node[draw, minimum width=2cm, minimum height=1cm, below left= 0.5cm and 0.5cm of c1] (c2) {};
\draw (c1.center) -- (250:2cm);
\draw (c1.center) -- (0:2cm);
\draw (0:1.5cm) arc [start angle=0, end angle=250, radius=1.5cm] node[midway, above left] {$250^\circ$};
\draw[fill=red] (c1.250) circle (2pt);
\draw (c1.250) |- (c2);
\end{scope}
\end{tikzpicture}
\end{document}

관련 정보