拼图图像的起点

拼图图像的起点

我对 Latex 完全陌生,我愿意画出下面的图像。如果您能建议任何创建此拼图图像的起点,包括稍微远离图形的切片,那将是一个很好的支持。任何库/包都可以提供一些基本支持。我想自己尝试一下,但不知道从哪里开始。

短暂性失眠!

在此处输入图片描述

答案1

这只是为了给你一个开始,而不是提供屏幕截图的精确复制。这个想法是剪裁一条路径,比如头部的边界,然后添加可以用软件包jigsaw和/或答案创建的拼图块这个问题或其他帖子。

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\tikzset{pics/.cd,
  jigsaw/.style={
    code={
\draw[#1,ultra thin,fill=#1] (-2,-0.25) to[out=90,in=135] (-1.75,-0.225) arc(-135:135:0.3 and
{0.225*sqrt(2)}) to[out=-135,in=-90] (-2,0.25) |- (-0.25,2)
to[out=0,in=-45] (-0.225,2.25) arc(225:-45:{0.25*sqrt(2)} and 0.3)
to[out=-135,in=180] (0.25,2) -| (2,0.25) 
to[out=-90,in=225] (2.25,0.225) arc(135:-135:0.3 and {0.225*sqrt(2)})
to[out=135,in=90] (2,-0.25) |- (0.25,-2)
to[out=180,in=-135] (0.225,-1.75) arc(-45:225:{0.225*sqrt(2)} and 0.3) 
to[out=-45,in=0] (-0.25,-2) -| cycle;
}}}
\begin{tikzpicture}[font=\sffamily\Large\bfseries,text=white]
 \begin{scope}
  \clip[scale=1.1] (-1,-4) to[out=50,in=-90,looseness=1.4] (-1,-3) to[out=-160,in=0]
   (-2,-3.2) to[out=180,in=-120] (-2.7,-2) to[out=120,in=-120] (-2.9,-1.5)
   to[out=120,in=-120] (-2.95,-1.1) to[out=60,in=-30] (-3.2,-0.9)
   to[out=150,in=-120] (-3,0.4) to[out=60,in=-90] (-3,1.2) 
   to[out=90,in=90,looseness=1.8] (3.3,1.2)
   to[out=-90,in=90,looseness=0.8] (2,-2)
   to[out=-90,in=150,looseness=0.8] (3.2,-4) -- cycle;
  \path (-6,4) pic{jigsaw=teal} (-2,4) pic{jigsaw=teal} (2,4) pic{jigsaw=gray}
   (-2,0) pic[rotate=90]{jigsaw=yellow!90!black} (2,0) pic[rotate=90]{jigsaw=orange}
   (-2,-4) pic{jigsaw=green!70!black} (2,-4) pic{jigsaw=green!70!black};
  \clip (-0.4,2) rectangle ++ (2,4);
  \path  (-1.2,4) pic{jigsaw=teal} ;
 \end{scope}
  \path (-1,3.4) node{01} (1.8,3.4) node{02}
  (1.7,0) node{03} (-1.7,0) node{04} (0,-3) node{05};
\end{tikzpicture}
\end{document}

在此处输入图片描述

附录:真的只是为了学习一些东西,并且从包中获取了很多东西jigsaw:使用普通的 TiZ 矩阵来绘制拼图。它可以至少在合理的范围内工作。语法是

\pic[<options>] {tile={r,t,l,b};

其中第一个条目是右侧的襟翼,-1含义为向外、1向内和0无襟翼。接下来是顶部、左侧和底部,分别对应 0 度、90 度、180 度和 270 度。

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\tikzset{side/.style={insert path={ -- (0,0)% \ifnum#1=0 \else \fi 
-| (0.5-0.1*\pgfkeysvalueof{/tikz/jigsaw/flap scale},#1*0.1*\pgfkeysvalueof{/tikz/jigsaw/flap scale})
 arc({225*#1}:{-45*#1}:{0.1*sqrt(2)*\pgfkeysvalueof{/tikz/jigsaw/flap scale}} and
 {0.1*sqrt(2)*\pgfkeysvalueof{/tikz/jigsaw/flap scale}*\pgfkeysvalueof{/tikz/jigsaw/flap ratio}}) 
 |-  (1,0)}},pics/tile/.style={code={
  \edef\sone{{#1}[0]}   
  \edef\stwo{{#1}[1]}   
  \edef\sthree{{#1}[2]} 
  \edef\sfour{{#1}[3]}  
  \path[every tile,pic actions,opacity=0] (0,0.002) rectangle (0.998,1);
  \path[every tile,pic actions,draw=none,overlay] (0,0)
    [side=\sfour,
    rotate around={90:(0.5,0.5)},side=\sone,
    rotate around={90:(0.5,0.5)},side=\stwo,
    rotate around={90:(0.5,0.5)},side=\sthree,
    ] -- cycle;    
  \path[every tile,pic actions,fill=none,overlay] (0,0)
    [side=\sfour,
    rotate around={90:(0.5,0.5)},side=\sone,
    rotate around={90:(0.5,0.5)},side=\stwo,
    rotate around={90:(0.5,0.5)},side=\sthree,
    ] -- cycle;     
}},pics/tile/.default={-1,1,1,-1},every tile/.style={},tiles/.style={every
tile/.append style={#1}},jigsaw/.cd,flap scale/.initial=1,flap
ratio/.initial=0.8}
\begin{tikzpicture}[font=\sffamily\Large\bfseries,text=white]
 \begin{scope}[tiles={scale=4}]
  \clip[scale=1.1] (-1,-4) to[out=50,in=-90,looseness=1.4] (-1,-3) to[out=-160,in=0]
   (-2,-3.2) to[out=180,in=-120] (-2.7,-2) to[out=120,in=-120] (-2.9,-1.5)
   to[out=120,in=-120] (-2.95,-1.1) to[out=60,in=-30] (-3.2,-0.9)
   to[out=150,in=-120] (-3,0.4) to[out=60,in=-90] (-3,1.2) 
   to[out=90,in=90,looseness=1.8] (3.3,1.2)
   to[out=-90,in=90,looseness=0.8] (2,-2)
   to[out=-90,in=150,looseness=0.8] (3.2,-4) -- cycle;
  \matrix (puzzle)
  {
  \pic[fill=teal]{tile={-1,0,0,1}}; & \pic[fill=gray]{tile={0,0,1,-1}}; \\
  \pic[fill=yellow!90!black]{tile={1,-1,0,-1}}; & \pic[fill=orange]{tile={0,1,-1,1}}; \\
  \pic[fill=green!70!black]{tile={0,1,0,0}}; &  \pic[fill=green!70!black]{tile={0,-1,0,0}};\\
  };
  \clip (-1,2) rectangle ++ (5,4); 
  \path (-3,2) pic[fill=teal]{tile={-1,0,0,0}};
 \end{scope}
 \path (-0.8,3.2) node{01} (2.5,3.2) node{02}
  (1.7,0) node{03} (-1.7,0) node{04} (0,-3) node{05};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容