한쪽이 구부러진 직사각형

한쪽이 구부러진 직사각형

아래 그림과 같이 한쪽이 곡선인 채워진 직사각형을 만들고 싶습니다. 여기에 이미지 설명을 입력하세요

\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의 알고리즘 사용)을 활용합니다.취미패키지는 다음으로 가져올 수 있습니다.틱즈. 직사각형의 두 기준점에서 적절한 방향(각도)을 지정하는 것으로 충분합니다.

어떤 엔진(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

저는 두 개의 호를 직사각형으로 연결하여 이 작업을 수행했습니다.

\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}

모양

원래 윤곽선(파란색)과 겹쳐진 경우:

오리지널

관련 정보