填充两条曲线之间

填充两条曲线之间

我试图填充区域之间的区域,但我不知道该怎么做。我试图填充线段 A_5、A_6 和多边形外部曲线部分之间的区域,连接 A-5 和 A_6。

\documentclass{standalone}
\usepackage{tikz, tkz-euclide}
\usetikzlibrary{hobby}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}[scale=2]
    \tkzDefPoints{-1.8/0/A_1, -0.5/1.2/A_2, -1.3/2.2/A_3, 0/3.7/A_4, 
    1.9/3.95/A_5, 3.4/3.3/A_6, 1.9/1.7/A_7, 3.6/0.9/A_8, 2.35/-1/A_9, 
    1/0.6/A_10, -1/-0.7/A_11}

    \draw[help lines, color=gray!30, dashed] (-2.5,-1.5) grid (4.1,5.1);
    \draw [->, >=stealth] (-2.5,0) -- (4.2,0) node [right] {$x$};
    \draw [->, >=stealth] (0,-1.5) -- (0,5) node [above] {$y$};

    \draw [very thick] (-1.8,0) to [closed, curve through = {(-1.5,0.2) 
     (-0.5,1.2) (-1.3,2.2) (0,3.7) (1.2,3.9)(1.8,3.945)(1.9,3.95) (3.4,3.3) 
    (2.5,2.6)(1.9,1.7) (2.2,1.6)(3.6,0.9) (3.65,0) (2.35,-1) (1.8,0) (1,0.6) 
    (0,0.3) (-0.2,0) (-1,-0.7) (-1.9,-0.7)}] (-1.8,0);

    \tkzDrawPolygon[very thick, dashed, fill=red!20,opacity=0.3]
    (A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11)

    \tkzDrawPolygon[very thick, fill=gray!30,opacity=.3]
    (A_1,A_3,A_4,A_5,A_6,A_8,A_9,A_11)

    \tkzDrawPoints[size=15,fill=black]
     (A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11)


    \tkzDrawSegment(A_5,A_6)
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

\documentclass{standalone}
\usepackage{tikz, tkz-euclide}
\usetikzlibrary{hobby}
\usetkzobj{all}

\begin{document}
    \begin{tikzpicture}[scale=2]
    \tkzDefPoints{-1.8/0/A_1, -0.5/1.2/A_2, -1.3/2.2/A_3, 0/3.7/A_4, 
        1.9/3.95/A_5, 3.4/3.3/A_6, 1.9/1.7/A_7, 3.6/0.9/A_8, 2.35/-1/A_9, 
        1/0.6/A_10, -1/-0.7/A_11,4/4/T_1,3.5/4.5/T_2}

    \draw[help lines, color=gray!30, dashed] (-2.5,-1.5) grid (4.1,5.1);
    \draw [->, >=stealth] (-2.5,0) -- (4.2,0) node [right] {$x$};
    \draw [->, >=stealth] (0,-1.5) -- (0,5) node [above] {$y$};

    \begin{scope}
    \path [clip] (-1.8,0) to [closed, curve through = {(-1.5,0.2) 
        (-0.5,1.2) (-1.3,2.2) (0,3.7) (1.2,3.9)(1.8,3.945)(1.9,3.95) (3.4,3.3) 
        (2.5,2.6)(1.9,1.7) (2.2,1.6)(3.6,0.9) (3.65,0) (2.35,-1) (1.8,0) (1,0.6) 
        (0,0.3) (-0.2,0) (-1,-0.7) (-1.9,-0.7)}] (-1.8,0);
    \tkzFillPolygon[fill=blue](A_5,A_6,T_1,T_2)
    \end{scope}


    \draw [very thick] (-1.8,0) to [closed, curve through = {(-1.5,0.2) 
        (-0.5,1.2) (-1.3,2.2) (0,3.7) (1.2,3.9)(1.8,3.945)(1.9,3.95) (3.4,3.3) 
        (2.5,2.6)(1.9,1.7) (2.2,1.6)(3.6,0.9) (3.65,0) (2.35,-1) (1.8,0) (1,0.6) 
        (0,0.3) (-0.2,0) (-1,-0.7) (-1.9,-0.7)}] (-1.8,0);

    \tkzDrawPolygon[very thick, dashed, fill=red!20,opacity=0.3]%
    (A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11)

    \tkzDrawPolygon[very thick, fill=gray!30,opacity=.3]%
    (A_1,A_3,A_4,A_5,A_6,A_8,A_9,A_11)

    \tkzDrawPoints[size=15,fill=black]%
    (A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11)

    \end{tikzpicture}

\end{document}

相关内容