
Eu gostaria de criar um retângulo preenchido com um lado curvo, como mostrado na imagem abaixo:
\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}
Não estou conseguindo preencher corretamente.
Responder1
Você pode usar tape
a forma da shapes
biblioteca tikz`.
\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}
Se você quiser desenhá-los deliberadamente, aqui vai:
\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}
Responder2
Esta é uma tentativa com o MetaPost, mas acho que pode ser facilmente adaptado paratikzusando opassatempopacote: aproveita as poderosas especificações e construções de caminho do MetaPost (usando o algoritmo de John Hobby) que opassatempopacote permite importar paratikz. Basta especificar direções adequadas (como ângulos) nos dois pontos base do retângulo.
Para ser processado com qualquer mecanismo (LaTeX, pdfLaTeX…) emfuga de conchamodo.
EDITAREu adicionei umtikzversão, utilizando assim opassatempopacote, no final deste post, produzindo a mesma imagem. O código é certamente um pouco rudimentar, pois não sei muito sobretikzainda.
\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}
Responder3
Consegui isso juntando dois arcos com um retângulo:
\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}
Quando sobreposto ao contorno original (em azul):