
Ich möchte ein ausgefülltes Rechteck mit einer gekrümmten Seite erstellen, wie in der Abbildung unten dargestellt:
\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}
Ich kann es nicht richtig ausfüllen.
Antwort1
tape
Sie können Formen aus der Tikz-Bibliothek verwenden 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}
Wenn Sie sie absichtlich zeichnen möchten, hier ist sie:
\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}
Antwort2
Dies ist ein Versuch mit MetaPost, aber ich denke, es kann leicht angepasst werden antikzVerwendung derHobbyPaket: Es nutzt die leistungsstarken Pfadspezifikationen und -konstruktionen von MetaPost (unter Verwendung des Algorithmus von John Hobby), die dasHobbyPaket ermöglicht den Import intikz. Es genügt, an den beiden Basispunkten des Rechtecks geeignete Richtungen (als Winkel) anzugeben.
Zur Verarbeitung mit jeder beliebigen Engine (LaTeX, pdfLaTeX…) inShell-FluchtModus.
BEARBEITENIch habe hinzugefügt:tikzVersion, mit derHobbyPaket, am Ende dieses Beitrags, das das gleiche Bild erzeugt. Der Code ist sicherlich ein bisschen rudimentär, da ich nicht viel weiß vontikznoch.
\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}
Antwort3
Dies habe ich erreicht, indem ich zwei Bögen mit einem Rechteck zusammengefügt habe:
\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}
Wenn es mit der Originalkontur (in Blau) überlagert wird: