此功能请求是否已有解决方案?我想绘制 90° 角和两个 45° 弯角,但无需手动操作(非常繁琐)。我正在寻找类似于圆角的东西,例如“弯角”。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[bended corners=0.1cm] (0,0) rectangle (5,5);
\end{tikzpicture}
\end{document}
结果应该类似于此代码:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
%\draw[bended corners=0.1cm] (0,0) rectangle (5,5);
\draw (0,0) -- (0.9,0) -- (1,0.1) -- (1,1);
\end{tikzpicture}
\end{document}
答案1
bended corners
也许我不明白这个问题,但是 OP和已经定义的有什么区别rounded corners
?
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid[step=.5cm] (5,5);
\draw[thick, blue, rounded corners=1cm] (0,0) rectangle (5,5);
\draw[red, opacity=.5, ultra thick] (4,5) arc(90:45:1);
\draw[green, opacity=.5, ultra thick] (5,4) arc(0:45:1);
\end{tikzpicture}
\end{document}
更新:第二次代码之后,我认为 OP 想要一个chamfered rectangle
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\begin{document}
\begin{tikzpicture}
%\draw[bended corners=0.1cm] (0,0) rectangle (5,5);
\node[draw, minimum size=3cm, chamfered rectangle] {};
\end{tikzpicture}
\end{document}