填充 tikz 中由节点符号分隔的两个区域

填充 tikz 中由节点符号分隔的两个区域

我正在寻找一种方法来完美地匹配这朵花周围每个区域的颜色。目前,通过一些粗暴的黑客坐标来延续我的节点后的线条,我只能用直线划分区域。

有没有办法按照花朵标志所规定的曲线来分离和填充这些区域?

平均能量损失

\documentclass[11pt,a4paper]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{bclogo}
\begin{document}
    \begin{tikzpicture}
        %%Make a projector
        \fill[black] (0,0) rectangle (0.5,0.2);
        \fill[black] (0.5,0.1) -- (0.7,0) -- (0.7,0.2) -- cycle;

        %%Make a surface
        \draw (4,-2.2) -- (4,2.2);

        %%Draw the red light
        \filldraw[red, fill=red!10] (0.7,0) -- (4,-1.6) -- (4,1.8) -- (0.7,0.2);

        %%Draw the object to have anchor
        \node[inner sep=0pt] (objet) at (2.8,0) {\bcfleur};

        %%1st part of the inner area (red)
        \fill[red!30] (0.7,0.1) -- (objet.north) -- (objet.south) -- cycle;
        %%2nd part of the inner area (gray)
        \fill[gray!50] (objet.south) -- (objet.north) -- (4,0.5) -- (4,-0.62) -- cycle;

        %%redraw the lines around the inner area
        \draw[red] (0.7,0.1) -- (objet.south);
        \draw[red] (0.7,0.1) -- (objet.north);
        \draw[gray] (objet.south) -- (4,-0.62);
        \draw[gray] (objet.north) -- (4,0.5);

        %%redraw the object
        \node[inner sep=0pt] at (2.8,0) {\bcfleur};
    \end{tikzpicture}
\end{document}

电流输出:

在此处输入图片描述

期望输出:

在此处输入图片描述

答案1

我认为除了找到一条适合的曲线之外没有其他办法。

\documentclass[tikz,11pt,a4paper]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{bclogo}
\begin{document}
    \begin{tikzpicture}
        %%Make a projector
        \fill[black] (0,0) rectangle (0.5,0.2);
        \fill[black] (0.5,0.1) -- (0.7,0) -- (0.7,0.2) -- cycle;

        %%Make a surface
        \draw (4,-2.2) -- (4,2.2);

        %%Draw the red light
        \filldraw[red, fill=red!10] (0.7,0) -- (4,-1.6) -- (4,1.8) -- (0.7,0.2);

        \pgfmathsetmacro{\myangle}{atan2(0.5,4)}
        %%1st part of the inner area (red)
        \draw[red,fill=red!30] (0.7,0.1) -- (-\myangle:2.78) to[out=78,in=-55] (\myangle:2.62) -- cycle;
        %%2nd part of the inner area (gray)
        \draw[gray,fill=gray!50] (4,-0.62) -- (-\myangle:2.78) to[out=78,in=-55] (\myangle:2.62) -- (4,0.5) ;

        %%redraw the object
        \node[inner sep=0pt] at (2.8,0) {\bcfleur};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容