我正在尝试画这个
我只能设法得到线条,但无法填充形状。这是我的代码
\begin{tikzpicture}[baseline=(current bounding box.north),level/.style={sibling distance=50mm/#1},scale =0.4]
\begin{scope}[yshift=-3/2]
\draw (0:2) \foreach \x in {60,120,...,360}
{-- (\x:2)}-- cycle (90:2) ;
\end{scope}
\path[fill=blue!60] (-2,0) arc (180:0:2) -- (2,0);
\path[fill=blue!60] (-2,0) arc (180:240:2) -- (0,0);
\draw
(180:2) -- (0:2)
(240:2) -- (60:1.95)
(300:2) -- (120:1.95);
\end{tikzpicture}
答案1
这是实现这一目标的无数种方法之一。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[baseline=(current bounding box.north),
scale =0.4,pics/trian/.style={code={\draw[pic actions]
(0,0) -- (-30:1) -- (30:1) -- cycle;}}]
\begin{scope}[yshift=-3/2]
\draw (0:2) foreach \X in {0,...,5}
{pic[rotate=60*\X+30,/utils/exec=\ifnum\X>1 \tikzset{fill=blue!60} \fi] {trian}
};
\end{scope}
\end{tikzpicture}
\end{document}
答案2
以下是使用 [turn] 选项的构建:
[turn]([turn]120:2)
选项将线沿着构建路径的切线方向向左旋转 120 度。
\documentclass[margin=5mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}[baseline=(current bounding box.north),level/.style={sibling distance=50mm/#1},scale =0.4]
\begin{scope}[yshift=-3/2]
% colouring
\foreach \x in {120,180,...,300}
\fill[blue!60] (0:0)-- (\x:2)--([turn]120:2);
% drawing
\foreach \x in {0,60,120,...,300}
\draw (0:0)-- (\x:2)--([turn]120:2);
\end{scope}
\end{tikzpicture}
\end{document}
答案3
只是为了好玩,一个版本有一些简化技巧,重复 tikz 所拥有的东西,以及从更常见的模型(例如 html)中获取颜色。
结果:
梅威瑟:
\documentclass[tikz,border=5pt]{standalone}
\definecolor{B}{HTML}{2E79B2}
\definecolor{W}{HTML}{FFFFFF}
\begin{document}
\begin{tikzpicture}[]
\def\Size{0.5cm}
\foreach \i [count=\j from 0] in {B,W,W,B,B,B}{
\draw[line join=round,fill=\i](0,0)--(60*\j:\Size)--++(-120+60*\j:\Size) -- cycle;
}
\end{tikzpicture}
\end{document}