在分形曲线下填充

在分形曲线下填充

我正在创建一个用于笔记的类,作为首页,我打算让分形贯穿页面的对角线和路径创建的两个部分,并填充不同的颜色。

正如您在图片中看到的,我设法得到了分形,但填充效果不佳。我尝试了不同的方法:\filldraw在创建分形时使用,使用path picture如图所示问答、剪辑等等,但它们的结果都与您在下图中看到的结果不同。

错误的结果

该图片由以下代码创建:

\documentclass{article}

\usepackage{tikzpagenodes}
\usetikzlibrary{decorations.fractals}

\begin{document}
\begin{tikzpicture}[overlay, remember picture]
  \fill[blue] (current page.north west) rectangle (current page.south east);
  \filldraw[fill=red,decoration=Koch curve type 2,draw=white,very thick]
    decorate {
      decorate {
        decorate {
          (current page.north west) --
          (current page.south east)
        }
      }
    };
\end{tikzpicture}
\end{document}

然后,我试图了解如何才能正确实现我想要的目标。有哪些选择?感谢您的时间!

答案1

正如 Phelype Oleinik 在评论中所建议的,这里是修复的代码:

\documentclass{article}

\usepackage{tikzpagenodes}
\usetikzlibrary{decorations.fractals}

\begin{document}
\begin{tikzpicture}[overlay, remember picture]
  \fill[blue] (current page.north west) rectangle (current page.south east);
  \fill[fill=red,decoration=Koch curve type 2,very thick]
    decorate {
      decorate {
        decorate {
          (current page.north west) --
          (current page.south east)
        }
      }
    } -- (current page.south west) -- cycle;
  \draw[draw=white,decoration=Koch curve type 2,very thick]
    decorate {
      decorate {
        decorate {
          (current page.north west) --
          (current page.south east)
        }
      }
    };
\end{tikzpicture}
\end{document}

相关内容