具有弯曲边缘和倒圆角的 tikz 矩形

具有弯曲边缘和倒圆角的 tikz 矩形

我需要先画一个边缘弯曲的矩形。然后我需要一个边缘弯曲且角圆的矩形。但角需要倒置(指向内部)。我手工绘制了一张图来说明:

在此处输入图片描述

答案1

请注意,我认为我不应该回答像这样的“为我做一切”的问题。另外,请注意,在这种情况下,我不太可能对后续行动做出回应,除非你的后续行动恰好吸引了我。如果您需要任何调整,我建议您添加以下一项或多项:

  1. 一只或多只猫,坐着或躺着;
  2. 一个或多个大锅;
  3. 一辆或多辆有轨电车或单层巴士。

\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}
  \draw (0,0) coordinate (a) [bend right=15] to +(2,0) coordinate (b) [bend right] to +(0,-1) coordinate (c) [bend right] to (a |- c) [bend right=15] to cycle ;
  \begin{scope}
    \clip (3,0) coordinate (A) +(.1,0) coordinate (A1) -- +(1.9,0) coordinate (B1) arc (180:270:.1) coordinate (B2) -- +(0,-.8) coordinate (C1) arc (90:190:.1) coordinate (C2) -- (C2 -| A1) arc (0:90:.1) -- (B2 -| A) arc (270:360:.1) ;
    \draw (A) coordinate (a') [bend right=15] to +(2,0) coordinate (b') [bend right] to +(0,-1) coordinate (c') [bend right] to (a' |- c') [bend right=15] to cycle ;
  \end{scope}
  \clip (a') [bend right=15] to (b') [bend right] to (c') [bend right] to (a' |- c') [bend right=15] to cycle ;
  \draw   (B1) arc (180:270:.1)  (C1) arc (90:190:.1)  (C2 -| A1) arc (0:90:.1)  (B2 -| A) arc (270:360:.1) ;
\end{tikzpicture}
\end{document}

咬弯盒子

答案2

不幸的是,这不是一个完整的答案,但我需要一个非常相似的形状:一个带有倒角但没有凸边的矩形。我做了一个形状(见此处:myshape.tex),其中可以选择要反转的角: 在此处输入图片描述

测试脚本相当小:

\RequirePackage{luatex85}
\documentclass[tikz,convert=false]{standalone}
\tikzset{
  shape example/.style={
    color=black!30,
    draw,
    fill=yellow!30,
    line width=.5cm,
  },
}

\input{myshape}

\begin{document}

\begin{tikzpicture}\Huge
  \node[rectangle with inverted corners, rectangle with inverted corners radius=20pt,
        rectangle with inverted corners selected={north west, north east},
        shape example, minimum height=6cm, inner ysep=1cm, inner xsep=.75cm] (s)
    {Rectangle with inverted corners\vrule width1pt height2cm};
  \foreach \anchor/\placement in
    {text/below, center/above, 70/above,
     base/below, base east/below, base west/below,
     mid/above, mid east/above, mid west/above,
     north/below, south/above, east/above, west/above,
     before north east/above, north east/below, after north east/above,
     before north west/above, north west/below, after north west/above,
     before south west/above, south west/above, after south west/below,
     before south east/below, south east/above, after south east/above}
  \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)}
    node[\placement=0mm] {\scriptsize\texttt{(s.\anchor)}};
\end{tikzpicture}
\end{document}

'''

相关内容