![我可以使用 `--` 语法绘制路径但仍然像`向右弯曲`吗?](https://linux22.com/image/372681/%E6%88%91%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%20%60--%60%20%E8%AF%AD%E6%B3%95%E7%BB%98%E5%88%B6%E8%B7%AF%E5%BE%84%E4%BD%86%E4%BB%8D%E7%84%B6%E5%83%8F%60%E5%90%91%E5%8F%B3%E5%BC%AF%E6%9B%B2%60%E5%90%97%EF%BC%9F.png)
我喜欢这种\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
这样我就可以移动\node
s
答案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}