边缘切向进入,而不是垂直于节点

边缘切向进入,而不是垂直于节点

在下面的代码中,将圆视为节点。边缘应指向节点的中心,而不是像白色顶点那样切向它。我不知道我错过了哪个顺序,也不知道原因是什么。你能发现吗?

在此处输入图片描述

\documentclass{standalone}
\usepackage{tikz}

\usetikzlibrary{automata}

\begin{document}

\begin{tikzpicture}[scale=.3,  
    semithick,auto,
      every state/.style={inner sep=.54mm,text=black,minimum size=0}]


\begin{scope}

    \foreach \i     in {0}
    {
    \node[state,minimum size=0,circle, draw,fill=red] (A\i) at (45*\i:2) {}; }
    \foreach \j     in {1}
    {\node[state,minimum size=0,circle, draw,fill=white] (A\j) at (45*\j:2) {}; 
    }


    \foreach \k  in {0}{
   \pgfmathsetmacro{\jp}{\k +1} 
   \path[-] 
    (A\k) edge[bend left=30] (A\jp)
    (A\k) edge[bend left=-30] (A\jp)
    (A\k) edge  (A\jp)
    ;
    }   
    \end{scope}    
    \end{tikzpicture} 
\end{document}

答案1

您可以\pgfmathsetmacro{\jp}{int(\k +1)}按照建议保罗·加博利在他的评论中,使用新的计数器:

\foreach \k [count=\jp from 1] {...}

完整的 MWE,与您的一些小改动如下:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{automata}

\begin{document}
\begin{tikzpicture}[scale=.3,
    semithick, auto,
    bend angle=30,
    every state/.style={inner sep=.54mm, text=black, minimum size=0}]
    \foreach \i     in {0}
    {
    \node[state,minimum size=0,circle, draw,fill=red] (A\i) at (45*\i:2) {}; }
    \foreach \j     in {1}
    {\node[state,minimum size=0,circle, draw,fill=white] (A\j) at (45*\j:2) {};
    }
    \foreach \k [count=\jp from 1] in {0}{
   \path    (A\k) edge[bend left] (A\jp)
            (A\k) edge[bend right] (A\jp)
            (A\k) edge  (A\jp);
    }
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容