我可以使用 `--` 语法绘制路径但仍然像`向右弯曲`吗?

我可以使用 `--` 语法绘制路径但仍然像`向右弯曲`吗?

我喜欢这种\draw (a) edge[bend right] (b) ;画图方式,因为它允许我稍微弯曲边缘而不必担心特定的控制点。我喜欢这种\draw (a) -- (b) -- (c) ;画图方式,因为它有助于在图形中绘制一系列边缘。

我可以通过某种方式将它们组合起来,使用语法来弯曲边缘--吗?

\begin{tikzpicture}[every node/.style={draw,fill,circle}]

% straight line edges, annoying repetition of "(b)"
\node (a) at (1,4) {} ;  \node (b) at (2,4) {} ;  \node (c) at (3,4.5) {} ;
\draw (a) edge (b) ;   \draw (b) edge (c) ;

% just curve one of them it a bit
\node (a) at (1,3) {} ;  \node (b) at (2,3) {} ;  \node (c) at (3,3.5) {} ;
\draw (a) edge[bend right] (b) ;   \draw (b) edge (c) ;

% straight lines also, less redundant
\node (a) at (1,2) {} ;  \node (b) at (2,2) {} ;  \node (c) at (3,2.5) {} ;
\draw (a) -- (b) -- (c) ;

% i want to do something like this
%\node (a) at (1,1) {} ;  \node (b) at (2,1) {} ;  \node (c) at (3,1) {} ;
%\draw (a) -- [bend right] (b) -- (c) ;

\end{tikzpicture}

我知道我可以使用控制点和其他构造来获得曲线路径,但我想要一些不涉及除 s 之外的坐标的东西,\node这样我就可以移动\nodes

答案1

像这样吗?

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[every node/.style={draw,fill,circle}]

% straight line edges, annoying repetition of "(b)"
\node (a) at (1,4) {} ;  \node (b) at (2,4) {} ;  \node (c) at (3,4.5) {} ;
\draw (a) edge (b) ;   \draw (b) edge (c) ;

% just curve one of them it a bit
\node (a) at (1,3) {} ;  \node (b) at (2,3) {} ;  \node (c) at (2,2) {} ;
\draw (a.center) to[bend right] (b.center) -- (c.center) ;

\end{tikzpicture}
\end{document}

相关内容