
Me gustaría crear un rectángulo relleno con un lado curvo como el que se muestra en la siguiente imagen:
\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}
No puedo llenarlo correctamente.
Respuesta1
Puedes usar tape
formas de shapes
la 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}
Si quieres dibujarlos deliberadamente, aquí tienes:
\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}
Respuesta2
Esta es una prueba con MetaPost, pero supongo que se puede adaptar fácilmente atikzutilizando elpasatiempopaquete: aprovecha las poderosas especificaciones y construcciones de ruta de MetaPost (usando el algoritmo de John Hobby) que elpasatiempoEl paquete permite importar atikz. Basta con indicar direcciones adecuadas (como ángulos) en los dos puntos básicos del rectángulo.
Para ser procesado con cualquier motor (LaTeX, pdfLaTeX…) enescape de conchamodo.
EDITARHe agregado untikzversión, utilizando así elpasatiempopaquete, al final de esta publicación, produciendo la misma imagen. El código es ciertamente un poco rudimentario ya que no sé mucho sobretikztodavía.
\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}
Respuesta3
Lo logré uniendo dos arcos con un rectá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}
Cuando se superpone con el contorno original (en azul):