
下の図に示すように、1 つの辺が曲線になっている塗りつぶされた長方形を作成したいと思います。
\begin{tikzpicture}
\draw[red,thick] (0,-3) -- (0,0) -- (3,0) -- (3,-3) edge [bend left] (1,-3);
\draw[red,thick,fill] (1,-3) edge [bend right] ( 0, -3) ;
\end{tikzpicture}
正しく記入できません。
答え1
tikz` ライブラリtape
のシェイプを使用できます。shapes
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
\node[tape, draw]{ABCD};
\node[tape, draw, tape bend top=none,tape bend height=2mm, %% tape bend bottom=none
tape bend bottom=out and in,fill=red,minimum width=2cm,minimum height=3cm] at (2.5, 0) {};
\end{tikzpicture}
\end{document}
意図的に描きたい場合は、次のようになります。
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
\draw[red,thick,fill=olive!40] (0,-3) -- (0,0) -- (3,0) -- (3,-3)
to [out=220,in=30] ( 0, -3) --cycle ;
\end{tikzpicture}
\begin{tikzpicture}
\draw[red,thick,fill=olive] (0,-3) -- (0,0) -- (3,0) -- (3,-3)
to [out=220,in=-40] (1,-3)
to [out=140,in=30] ( 0, -3) --cycle ;
\end{tikzpicture}
\end{document}
答え2
これはMetaPostを使った試みですが、簡単に適応できると思います。ティックズ使用して趣味パッケージ:MetaPostの強力なパス仕様と構造(John Hobbyのアルゴリズムを使用)を活用し、趣味パッケージはインポートを許可しますティックズ長方形の 2 つの基点において適切な方向 (角度として) を指定するだけで十分です。
任意のエンジン(LaTeX、pdfLaTeXなど)で処理するには、シェルエスケープモード。
編集追加しましたティックズバージョン、このように使用趣味この投稿の最後にあるパッケージでは、同じ画像が生成されます。コードは確かに少し初歩的です。ティックズまだ。
\documentclass{article}
\usepackage[shellescape]{gmp}
\begin{document}
\begin{mpost*}
u = 1cm; % scale
myangle = 30; % "curving" parameter, in degrees
z = (2u, 3u);
path rect; rect = origin{dir myangle} .. (x, 0){dir myangle} -- z -- (0, y) -- cycle;
fill rect withcolor red; draw rect withcolor blue;
\end{mpost*}
\end{document}
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}
\draw[blue, fill=red, use Hobby shortcut] ([out angle = 30, in angle = -150]0,0) .. (2,0)
-- (2,3) -- (0,3) -- cycle ;
\end{tikzpicture}
\end{document}
答え3
私は 2 つの円弧を長方形で組み合わせることでこれを実現しました。
\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\def\x{34.0} % Angle parameter
\def\y{1.79} % Radius parameter
\begin{tikzpicture}
\fill[red,thick] (0,-3) -- (0,0) -- (3,0) -- (3,-3) -- cycle;
\filldraw[red] (3,-2.99) arc (-90+\x:-90-\x:\y);
\filldraw[white] (0,-3.01) arc (90+\x:90-\x:\y/2);
\end{tikzpicture}
\end{document}
元のアウトライン(青色)と重ねた場合: