많은 길로 둘러싸인 영역을 채우다

많은 길로 둘러싸인 영역을 채우다

다음 코드를 고려해보세요. 내가 하고 싶은 일은 그림에서 빨간색으로 표시된 부분을 채우는 것입니다. 어떻게 해야 하나요?

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
    \begin{tikzpicture}
    \draw (0,0) -- (2,0);

    \draw(0,0) -- (0,2.3); 

    \begin{scope}
    \clip (0,0) rectangle (2,2.7);
    \draw[name path=arc] (0,2.3) arc (-105:-60:3.5);
    \end{scope}

    \path[name path=l] (2,0) -- (2,2.6);
    \path[name intersections={of=arc and l, by=x}];
    \draw (2,0) -- (x);
    \draw[densely dotted] (0,2.3) -- (0,2.7) (x) -- (2,2.7) (0,2.7) -- (2,2.7);
    \draw[densely dotted] (0,2.2) -- (2,2.2);
    \node at (2.62,2.2) {$h_0-h_1$};
    \node at (2.2,2.7) {$h_0$};
    \end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

답변1

사진을 시작하세요

\begin{scope}
\clip (0,0) -- (0,2.3) arc (-105:-60:3.5) |- (0,0);
\fill[red] (0,2.2) rectangle (2,2.7);
\end{scope}

여기에 이미지 설명을 입력하세요

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
    \begin{tikzpicture}
    \begin{scope}
    \clip (0,0) -- (0,2.3) arc (-105:-60:3.5) |- (0,0);
    \fill[red] (0,2.2) rectangle (2,2.7);
    \end{scope}

    \draw (0,0) -- (2,0);

    \draw (0,0) -- (0,2.3); 

    \begin{scope}
    \clip (0,0) rectangle (2,2.7);
    \draw[name path=arc] (0,2.3) arc (-105:-60:3.5);
    \end{scope}

    \path[name path=l] (2,0) -- (2,2.6);
    \path[name intersections={of=arc and l, by=x}];
    \draw (2,0) -- (x);
    \draw[densely dotted] (0,2.3) -- (0,2.7) (x) -- (2,2.7) (0,2.7) -- (2,2.7);
    \draw[densely dotted] (0,2.2) -- (2,2.2);
    \node at (2.62,2.2) {$h_0-h_1$};
    \node at (2.2,2.7) {$h_0$};
    \end{tikzpicture}
\end{document}

관련 정보