无法将翻译与绘图坐标结合起来

无法将翻译与绘图坐标结合起来

我有一段 TikZ 代码,它运行良好,直到我尝试重写其中的某些部分,以便通过将某些点定义为其他点的平移来使其更具可定制性。当我开始这样做时,图片的一部分消失了。

以下是解释该问题的完整文件内容:该文件包含两个几乎相同的 TikZ 图片。唯一的区别是,在第二张图片中,点 (C1) 到 (C24) 是“从无到有”定义的,而在第一张图片中,它们被定义为 (A5) 的平移,其坐标为 (0,0)。黑线出现在第二张图片上,但在第一张图片上没有。为什么?我该如何解决这个问题?

TIA 寻求任何形式的帮助。

\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage{calc}
\usepackage{lscape}

\begin{document}
\pagestyle{empty}




 \noindent\begin{tikzpicture}[x=0.5cm,y=0.5cm]
 % Proportionality constants
  \newcommand*{\jay}{0.25}%
  \newcommand*{\kay}{2}%
 \newcommand*{\hay}{3}%
 \newcommand*{\way}{4}%
  \newcommand*{\bay}{3.5}%
 % Fundamental coordinates of points or vectors
  \newcommand*{\xv}{-2*\jay}%
  \newcommand*{\yv}{-0.5*\jay}%
  \newcommand*{\xfive}{0*\jay}%
  \newcommand*{\yfive}{0*\jay}%
  % Deduced coordinates
 \pgfmathsetmacro{\xu}{\bay*\yv}% 
 \pgfmathsetmacro{\yu}{-\bay*\xv}% 
 \pgfmathsetmacro{\xsix}{\xfive+\way*\xu}% 
 \pgfmathsetmacro{\ysix}{\yfive+\way*\yu}% 
 \pgfmathsetmacro{\xten}{\xfive+2*\xv}% 
 \pgfmathsetmacro{\yten}{\yfive+2*\yv}% 
\pgfmathsetmacro{\xeleven}{\xten+\way*\xu}% 
 \pgfmathsetmacro{\yeleven}{\yten+\way*\yu}% 
\pgfmathsetmacro{\xone}{\xsix+\xv}% 
 \pgfmathsetmacro{\yone}{\ysix+\yv}% 
\pgfmathsetmacro{\xtwo}{\xone+\xu}% 
 \pgfmathsetmacro{\ytwo}{\yone+\yu}% 
\pgfmathsetmacro{\xthree}{\xtwo+\kay*\xu}% 
 \pgfmathsetmacro{\ythree}{\ytwo+\kay*\yu}% 
\pgfmathsetmacro{\xtwentytwo}{\xtwo-\hay*\xv}% 
 \pgfmathsetmacro{\ytwentytwo}{\ytwo-\hay*\yv}% 
\pgfmathsetmacro{\xtwentythree}{\xtwentytwo+\kay*\xu}% 
 \pgfmathsetmacro{\ytwentythree}{\ytwentytwo+\kay*\yu}% 
\pgfmathsetmacro{\xseventeen}{\xtwentytwo-\xv}% 
 \pgfmathsetmacro{\yseventeen}{\ytwentytwo-\yv}% 
 \pgfmathsetmacro{\xeighteen}{\xseventeen+\kay*\xu}% 
 \pgfmathsetmacro{\yeighteen}{\yseventeen+\kay*\yu}% 
 \pgfmathsetmacro{\xseven}{\xtwo+\hay*\xv}% 
 \pgfmathsetmacro{\yseven}{\ytwo+\hay*\yv}% 
 \pgfmathsetmacro{\xeight}{\xseven+\kay*\xu}% 
 \pgfmathsetmacro{\yeight}{\yseven+\kay*\yu}% 
 \pgfmathsetmacro{\xtwelve}{\xseven+\xv}% 
 \pgfmathsetmacro{\ytwelve}{\yseven+\yv}% 
  \pgfmathsetmacro{\xthirteen}{\xtwelve+\kay*\xu}% 
 \pgfmathsetmacro{\ythirteen}{\ytwelve+\kay*\yu}% 
 \pgfmathsetmacro{\xfour}{\xthree+\hay*\yv}% 
 \pgfmathsetmacro{\yfour}{\ythree-\hay*\xv}% 
 \pgfmathsetmacro{\xnine}{\xfour+\yv}% 
 \pgfmathsetmacro{\ynine}{\yfour-\xv}% 
 \pgfmathsetmacro{\xfourteen}{\xfive+\xv-\yv}% 
 \pgfmathsetmacro{\yfourteen}{\yfive+\xv+\yv}% 
  \coordinate (A1) at (\xone,\yone);
  \coordinate (A2) at (\xtwo,\ytwo);
  \coordinate (A3) at (\xthree,\ythree);
  \coordinate (A4) at (\xfour,\yfour);
  \coordinate (A5) at (\xfive,\yfive);
  \coordinate (A6) at (\xsix,\ysix);  
  \coordinate (A7) at (\xseven,\yseven);
  \coordinate (A8) at (\xeight,\yeight);  
  \coordinate (A9) at (\xnine,\ynine);   
  \coordinate (A10) at (\xten,\yten);    
\coordinate (A11) at (\xeleven,\yeleven);    
\coordinate (A12) at (\xtwelve,\ytwelve);    
\coordinate (A13) at (\xthirteen,\ythirteen);    
\coordinate (A14) at (\xfourteen,\yfourteen);    
\coordinate (A17) at (\xseventeen,\yseventeen);   
\coordinate (A18) at (\xeighteen,\yeighteen);   
\coordinate (A22) at (\xtwentytwo,\ytwentytwo);  
\coordinate (A23) at (\xtwentythree,\ytwentythree);    
  \fill[fill=red] (A14) -- (A5) -- (A6) -- (A11) -- (A10) -- cycle;
  \fill[fill=red] (A6) -- (A17) -- (A22) -- (A1) -- cycle;
  \fill[fill=red] (A17) -- (A18) -- (A23) -- (A22) -- cycle;
 \fill[fill=red] (A7) -- (A8) -- (A13) -- (A12) -- cycle;
 %\draw (A23) -- (A4) -- (A8);
% \draw (A23) .. controls (A14) .. (A4);
 \pgfmathsetmacro{\dee}{\hay*(veclen(\xv,\yv))}% 
 \pgfmathsetmacro{\deetwo}{(\hay+1)*(veclen(\xv,\yv))}% 
 \pgfmathsetmacro{\anglestart}{atan2(\xtwentythree-\xthree,\ytwentythree-\ythree)}%
 \pgfmathsetmacro{\angletarget}{atan2(\xeight-\xthree,\yeight-\ythree)}%
   \fill[fill=red]  (A23) arc (\anglestart:\anglestart+180:\dee) -- (A13) arc (\anglestart+180:\anglestart:\deetwo) -- (A23);
 %\draw[red]  (A23) arc (\angletarget:\anglestart:\dee) -- (A13) arc (\anglestart:\angletarget:\deetwo) -- (A23);
 %\draw[step=0.1cm,gray] (-1,0) grid (15,6);
  %\draw [step=1cm] (-1,0) grid (15,6);
\coordinate (C1) at (A5) ++(-5,3.4);
\coordinate (C2) at (A5) ++(-4,4);
\coordinate (C3) at (A5) ++(-3.6,5);    
\coordinate (C4) at (A5) ++(-4.5,6);    
\coordinate (C5) at (A5) ++(-4.7,7);
\coordinate (C6) at (A5) ++(-4,8);
\coordinate (C7) at (A5) ++(-3,8.6);
\coordinate (C25) at (A5) ++(-2.7,9);    
\coordinate (C8) at (A5) ++(-2.4,10);    
\coordinate (C9) at (A5) ++(-2.8,11);
\coordinate (C10) at (A5) ++(-2,11.5);    
\coordinate (C11) at (A5) ++(-1,12);
\coordinate (C12) at (A5) ++(-0.3,12.4);   
\coordinate (C13) at (A5) ++(-0.3,12.6);    
\coordinate (C14) at (A5) ++(-1,12.2);    
\coordinate (C15) at (A5) ++(-2,11.7);
\coordinate (C16) at (A5) ++(-3.1,11);    
\coordinate (C17) at (A5) ++(-2.6,10);
\coordinate (C18) at (A5) ++(-2.9,9);    
\coordinate (C26) at (A5) ++(-4,8.2);
\coordinate (C19) at (A5) ++(-4.3,8);
\coordinate (C20) at (A5) ++(-4.9,7);    
\coordinate (C21) at (A5) ++(-4.7,6);
\coordinate (C22) at (A5) ++(-3.8,5);   
\coordinate (C23) at (A5) ++(-4.2,4);    
\coordinate (C24) at (A5) ++(-5,3.6);   
\filldraw plot [smooth cycle] coordinates { (C1)  (C2)  (C3) (C4) (C5) (C6) (C7) (C25) (C8) (C9) (C10)  
(C11) (C12) (C13) (C14) (C15) (C16) (C17) (C18) (C26) (C19) (C20) (C21) (C22) (C23) (C24)};
 \fill[fill=red] (A1) -- (A7) -- (A12) -- (A11) -- cycle;
\end{tikzpicture}


 \noindent\begin{tikzpicture}[x=0.5cm,y=0.5cm]
 % Proportionality constants
  \newcommand*{\jay}{0.25}%
  \newcommand*{\kay}{2}%
 \newcommand*{\hay}{3}%
 \newcommand*{\way}{4}%
  \newcommand*{\bay}{3.5}%
 % Fundamental coordinates of points or vectors
  \newcommand*{\xv}{-2*\jay}%
  \newcommand*{\yv}{-0.5*\jay}%
  \newcommand*{\xfive}{0*\jay}%
  \newcommand*{\yfive}{0*\jay}%
  % Deduced coordinates
 \pgfmathsetmacro{\xu}{\bay*\yv}% 
 \pgfmathsetmacro{\yu}{-\bay*\xv}% 
 \pgfmathsetmacro{\xsix}{\xfive+\way*\xu}% 
 \pgfmathsetmacro{\ysix}{\yfive+\way*\yu}% 
 \pgfmathsetmacro{\xten}{\xfive+2*\xv}% 
 \pgfmathsetmacro{\yten}{\yfive+2*\yv}% 
\pgfmathsetmacro{\xeleven}{\xten+\way*\xu}% 
 \pgfmathsetmacro{\yeleven}{\yten+\way*\yu}% 
\pgfmathsetmacro{\xone}{\xsix+\xv}% 
 \pgfmathsetmacro{\yone}{\ysix+\yv}% 
\pgfmathsetmacro{\xtwo}{\xone+\xu}% 
 \pgfmathsetmacro{\ytwo}{\yone+\yu}% 
\pgfmathsetmacro{\xthree}{\xtwo+\kay*\xu}% 
 \pgfmathsetmacro{\ythree}{\ytwo+\kay*\yu}% 
\pgfmathsetmacro{\xtwentytwo}{\xtwo-\hay*\xv}% 
 \pgfmathsetmacro{\ytwentytwo}{\ytwo-\hay*\yv}% 
\pgfmathsetmacro{\xtwentythree}{\xtwentytwo+\kay*\xu}% 
 \pgfmathsetmacro{\ytwentythree}{\ytwentytwo+\kay*\yu}% 
\pgfmathsetmacro{\xseventeen}{\xtwentytwo-\xv}% 
 \pgfmathsetmacro{\yseventeen}{\ytwentytwo-\yv}% 
 \pgfmathsetmacro{\xeighteen}{\xseventeen+\kay*\xu}% 
 \pgfmathsetmacro{\yeighteen}{\yseventeen+\kay*\yu}% 
 \pgfmathsetmacro{\xseven}{\xtwo+\hay*\xv}% 
 \pgfmathsetmacro{\yseven}{\ytwo+\hay*\yv}% 
 \pgfmathsetmacro{\xeight}{\xseven+\kay*\xu}% 
 \pgfmathsetmacro{\yeight}{\yseven+\kay*\yu}% 
 \pgfmathsetmacro{\xtwelve}{\xseven+\xv}% 
 \pgfmathsetmacro{\ytwelve}{\yseven+\yv}% 
  \pgfmathsetmacro{\xthirteen}{\xtwelve+\kay*\xu}% 
 \pgfmathsetmacro{\ythirteen}{\ytwelve+\kay*\yu}% 
 \pgfmathsetmacro{\xfour}{\xthree+\hay*\yv}% 
 \pgfmathsetmacro{\yfour}{\ythree-\hay*\xv}% 
 \pgfmathsetmacro{\xnine}{\xfour+\yv}% 
 \pgfmathsetmacro{\ynine}{\yfour-\xv}% 
 \pgfmathsetmacro{\xfourteen}{\xfive+\xv-\yv}% 
 \pgfmathsetmacro{\yfourteen}{\yfive+\xv+\yv}% 
  \coordinate (A1) at (\xone,\yone);
  \coordinate (A2) at (\xtwo,\ytwo);
  \coordinate (A3) at (\xthree,\ythree);
  \coordinate (A4) at (\xfour,\yfour);
  \coordinate (A5) at (\xfive,\yfive);
  \coordinate (A6) at (\xsix,\ysix);  
  \coordinate (A7) at (\xseven,\yseven);
  \coordinate (A8) at (\xeight,\yeight);  
  \coordinate (A9) at (\xnine,\ynine);   
  \coordinate (A10) at (\xten,\yten);    
\coordinate (A11) at (\xeleven,\yeleven);    
\coordinate (A12) at (\xtwelve,\ytwelve);    
\coordinate (A13) at (\xthirteen,\ythirteen);    
\coordinate (A14) at (\xfourteen,\yfourteen);    
\coordinate (A17) at (\xseventeen,\yseventeen);   
\coordinate (A18) at (\xeighteen,\yeighteen);   
\coordinate (A22) at (\xtwentytwo,\ytwentytwo);  
\coordinate (A23) at (\xtwentythree,\ytwentythree);    
  \fill[fill=red] (A14) -- (A5) -- (A6) -- (A11) -- (A10) -- cycle;
  \fill[fill=red] (A6) -- (A17) -- (A22) -- (A1) -- cycle;
  \fill[fill=red] (A17) -- (A18) -- (A23) -- (A22) -- cycle;
 \fill[fill=red] (A7) -- (A8) -- (A13) -- (A12) -- cycle;
 %\draw (A23) -- (A4) -- (A8);
% \draw (A23) .. controls (A14) .. (A4);
 \pgfmathsetmacro{\dee}{\hay*(veclen(\xv,\yv))}% 
 \pgfmathsetmacro{\deetwo}{(\hay+1)*(veclen(\xv,\yv))}% 
 \pgfmathsetmacro{\anglestart}{atan2(\xtwentythree-\xthree,\ytwentythree-\ythree)}%
 \pgfmathsetmacro{\angletarget}{atan2(\xeight-\xthree,\yeight-\ythree)}%
   \fill[fill=red]  (A23) arc (\anglestart:\anglestart+180:\dee) -- (A13) arc (\anglestart+180:\anglestart:\deetwo) -- (A23);
 %\draw[red]  (A23) arc (\angletarget:\anglestart:\dee) -- (A13) arc (\anglestart:\angletarget:\deetwo) -- (A23);
 %\draw[step=0.1cm,gray] (-1,0) grid (15,6);
  %\draw [step=1cm] (-1,0) grid (15,6);
\coordinate (C1) at  (-5,3.4);
\coordinate (C2) at  (-4,4);
\coordinate (C3) at  (-3.6,5);    
\coordinate (C4) at  (-4.5,6);    
\coordinate (C5) at  (-4.7,7);
\coordinate (C6) at  (-4,8);
\coordinate (C7) at  (-3,8.6);
\coordinate (C25) at  (-2.7,9);    
\coordinate (C8) at  (-2.4,10);    
\coordinate (C9) at  (-2.8,11);
\coordinate (C10) at  (-2,11.5);    
\coordinate (C11) at  (-1,12);
\coordinate (C12) at  (-0.3,12.4);   
\coordinate (C13) at  (-0.3,12.6);    
\coordinate (C14) at  (-1,12.2);    
\coordinate (C15) at  (-2,11.7);
\coordinate (C16) at  (-3.1,11);    
\coordinate (C17) at  (-2.6,10);
\coordinate (C18) at  (-2.9,9);    
\coordinate (C26) at  (-4,8.2);
\coordinate (C19) at  (-4.3,8);
\coordinate (C20) at  (-4.9,7);    
\coordinate (C21) at  (-4.7,6);
\coordinate (C22) at  (-3.8,5);   
\coordinate (C23) at  (-4.2,4);    
\coordinate (C24) at  (-5,3.6);   
\filldraw plot [smooth cycle] coordinates { (C1)  (C2)  (C3) (C4) (C5) (C6) (C7) (C25) (C8) (C9) (C10)  
(C11) (C12) (C13) (C14) (C15) (C16) (C17) (C18) (C26) (C19) (C20) (C21) (C22) (C23) (C24)};
 \fill[fill=red] (A1) -- (A7) -- (A12) -- (A11) -- cycle;
\end{tikzpicture}


\end{document}

答案1

而不是\coordinate (C1) at (A5) ++(-5,3.4);(我认为这是错误的)使用移位范围来移动所有C*坐标。您可以查看下一个代码以了解如何执行此操作。

无论如何,pics如果您需要重复此图,我会考虑使用(或一些类似的宏)。我不知道是否\pgfmathsetmacro可以在图片中使用命令。

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lscape}

\begin{document}
\pagestyle{empty}

 \noindent\begin{tikzpicture}[x=0.5cm,y=0.5cm]
 % Proportionality constants
  \newcommand*{\jay}{0.25}%
  \newcommand*{\kay}{2}%
 \newcommand*{\hay}{3}%
 \newcommand*{\way}{4}%
  \newcommand*{\bay}{3.5}%
 % Fundamental coordinates of points or vectors
  \newcommand*{\xv}{-2*\jay}%
  \newcommand*{\yv}{-0.5*\jay}%
  \newcommand*{\xfive}{0*\jay}%
  \newcommand*{\yfive}{0*\jay}%
  % Deduced coordinates
 \pgfmathsetmacro{\xu}{\bay*\yv}% 
 \pgfmathsetmacro{\yu}{-\bay*\xv}% 
 \pgfmathsetmacro{\xsix}{\xfive+\way*\xu}% 
 \pgfmathsetmacro{\ysix}{\yfive+\way*\yu}% 
 \pgfmathsetmacro{\xten}{\xfive+2*\xv}% 
 \pgfmathsetmacro{\yten}{\yfive+2*\yv}% 
\pgfmathsetmacro{\xeleven}{\xten+\way*\xu}% 
 \pgfmathsetmacro{\yeleven}{\yten+\way*\yu}% 
\pgfmathsetmacro{\xone}{\xsix+\xv}% 
 \pgfmathsetmacro{\yone}{\ysix+\yv}% 
\pgfmathsetmacro{\xtwo}{\xone+\xu}% 
 \pgfmathsetmacro{\ytwo}{\yone+\yu}% 
\pgfmathsetmacro{\xthree}{\xtwo+\kay*\xu}% 
 \pgfmathsetmacro{\ythree}{\ytwo+\kay*\yu}% 
\pgfmathsetmacro{\xtwentytwo}{\xtwo-\hay*\xv}% 
 \pgfmathsetmacro{\ytwentytwo}{\ytwo-\hay*\yv}% 
\pgfmathsetmacro{\xtwentythree}{\xtwentytwo+\kay*\xu}% 
 \pgfmathsetmacro{\ytwentythree}{\ytwentytwo+\kay*\yu}% 
\pgfmathsetmacro{\xseventeen}{\xtwentytwo-\xv}% 
 \pgfmathsetmacro{\yseventeen}{\ytwentytwo-\yv}% 
 \pgfmathsetmacro{\xeighteen}{\xseventeen+\kay*\xu}% 
 \pgfmathsetmacro{\yeighteen}{\yseventeen+\kay*\yu}% 
 \pgfmathsetmacro{\xseven}{\xtwo+\hay*\xv}% 
 \pgfmathsetmacro{\yseven}{\ytwo+\hay*\yv}% 
 \pgfmathsetmacro{\xeight}{\xseven+\kay*\xu}% 
 \pgfmathsetmacro{\yeight}{\yseven+\kay*\yu}% 
 \pgfmathsetmacro{\xtwelve}{\xseven+\xv}% 
 \pgfmathsetmacro{\ytwelve}{\yseven+\yv}% 
  \pgfmathsetmacro{\xthirteen}{\xtwelve+\kay*\xu}% 
 \pgfmathsetmacro{\ythirteen}{\ytwelve+\kay*\yu}% 
 \pgfmathsetmacro{\xfour}{\xthree+\hay*\yv}% 
 \pgfmathsetmacro{\yfour}{\ythree-\hay*\xv}% 
 \pgfmathsetmacro{\xnine}{\xfour+\yv}% 
 \pgfmathsetmacro{\ynine}{\yfour-\xv}% 
 \pgfmathsetmacro{\xfourteen}{\xfive+\xv-\yv}% 
 \pgfmathsetmacro{\yfourteen}{\yfive+\xv+\yv}% 
  \coordinate (A1) at (\xone,\yone);
  \coordinate (A2) at (\xtwo,\ytwo);
  \coordinate (A3) at (\xthree,\ythree);
  \coordinate (A4) at (\xfour,\yfour);
  \coordinate (A5) at (\xfive,\yfive);
  \coordinate (A6) at (\xsix,\ysix);  
  \coordinate (A7) at (\xseven,\yseven);
  \coordinate (A8) at (\xeight,\yeight);  
  \coordinate (A9) at (\xnine,\ynine);   
  \coordinate (A10) at (\xten,\yten);    
\coordinate (A11) at (\xeleven,\yeleven);    
\coordinate (A12) at (\xtwelve,\ytwelve);    
\coordinate (A13) at (\xthirteen,\ythirteen);    
\coordinate (A14) at (\xfourteen,\yfourteen);    
\coordinate (A17) at (\xseventeen,\yseventeen);   
\coordinate (A18) at (\xeighteen,\yeighteen);   
\coordinate (A22) at (\xtwentytwo,\ytwentytwo);  
\coordinate (A23) at (\xtwentythree,\ytwentythree);    
  \fill[fill=red] (A14) -- (A5) -- (A6) -- (A11) -- (A10) -- cycle;
  \fill[fill=red] (A6) -- (A17) -- (A22) -- (A1) -- cycle;
  \fill[fill=red] (A17) -- (A18) -- (A23) -- (A22) -- cycle;
 \fill[fill=red] (A7) -- (A8) -- (A13) -- (A12) -- cycle;
 %\draw (A23) -- (A4) -- (A8);
% \draw (A23) .. controls (A14) .. (A4);
 \pgfmathsetmacro{\dee}{\hay*(veclen(\xv,\yv))}% 
 \pgfmathsetmacro{\deetwo}{(\hay+1)*(veclen(\xv,\yv))}% 
 \pgfmathsetmacro{\anglestart}{atan2(\xtwentythree-\xthree,\ytwentythree-\ythree)}%
 \pgfmathsetmacro{\angletarget}{atan2(\xeight-\xthree,\yeight-\ythree)}%
   \fill[fill=red]  (A23) arc (\anglestart:\anglestart+180:\dee) -- (A13) arc (\anglestart+180:\anglestart:\deetwo) -- (A23);
 %\draw[red]  (A23) arc (\angletarget:\anglestart:\dee) -- (A13) arc (\anglestart:\angletarget:\deetwo) -- (A23);
 %\draw[step=0.1cm,gray] (-1,0) grid (15,6);
  %\draw [step=1cm] (-1,0) grid (15,6);
  \begin{scope}[shift={(0,0)}] %<------------------- new line
\coordinate (C1) at  (-5,3.4);
\coordinate (C2) at  (-4,4);
\coordinate (C3) at  (-3.6,5);    
\coordinate (C4) at  (-4.5,6);    
\coordinate (C5) at  (-4.7,7);
\coordinate (C6) at  (-4,8);
\coordinate (C7) at  (-3,8.6);
\coordinate (C25) at  (-2.7,9);    
\coordinate (C8) at  (-2.4,10);    
\coordinate (C9) at  (-2.8,11);
\coordinate (C10) at  (-2,11.5);    
\coordinate (C11) at  (-1,12);
\coordinate (C12) at  (-0.3,12.4);   
\coordinate (C13) at  (-0.3,12.6);    
\coordinate (C14) at  (-1,12.2);    
\coordinate (C15) at  (-2,11.7);
\coordinate (C16) at  (-3.1,11);    
\coordinate (C17) at  (-2.6,10);
\coordinate (C18) at  (-2.9,9);    
\coordinate (C26) at  (-4,8.2);
\coordinate (C19) at  (-4.3,8);
\coordinate (C20) at  (-4.9,7);    
\coordinate (C21) at  (-4.7,6);
\coordinate (C22) at  (-3.8,5);   
\coordinate (C23) at  (-4.2,4);    
\coordinate (C24) at  (-5,3.6);   
\filldraw plot [smooth cycle] coordinates { (C1)  (C2)  (C3) (C4) (C5) (C6) (C7) (C25) (C8) (C9) (C10)  
(C11) (C12) (C13) (C14) (C15) (C16) (C17) (C18) (C26) (C19) (C20) (C21) (C22) (C23) (C24)};
\end{scope} %<----------------------------- new line
 \fill[fill=red] (A1) -- (A7) -- (A12) -- (A11) -- cycle;
\end{tikzpicture}

 \noindent\begin{tikzpicture}[x=0.5cm,y=0.5cm]
 % Proportionality constants
  \newcommand*{\jay}{0.25}%
  \newcommand*{\kay}{2}%
 \newcommand*{\hay}{3}%
 \newcommand*{\way}{4}%
  \newcommand*{\bay}{3.5}%
 % Fundamental coordinates of points or vectors
  \newcommand*{\xv}{-2*\jay}%
  \newcommand*{\yv}{-0.5*\jay}%
  \newcommand*{\xfive}{0*\jay}%
  \newcommand*{\yfive}{0*\jay}%
  % Deduced coordinates
 \pgfmathsetmacro{\xu}{\bay*\yv}% 
 \pgfmathsetmacro{\yu}{-\bay*\xv}% 
 \pgfmathsetmacro{\xsix}{\xfive+\way*\xu}% 
 \pgfmathsetmacro{\ysix}{\yfive+\way*\yu}% 
 \pgfmathsetmacro{\xten}{\xfive+2*\xv}% 
 \pgfmathsetmacro{\yten}{\yfive+2*\yv}% 
\pgfmathsetmacro{\xeleven}{\xten+\way*\xu}% 
 \pgfmathsetmacro{\yeleven}{\yten+\way*\yu}% 
\pgfmathsetmacro{\xone}{\xsix+\xv}% 
 \pgfmathsetmacro{\yone}{\ysix+\yv}% 
\pgfmathsetmacro{\xtwo}{\xone+\xu}% 
 \pgfmathsetmacro{\ytwo}{\yone+\yu}% 
\pgfmathsetmacro{\xthree}{\xtwo+\kay*\xu}% 
 \pgfmathsetmacro{\ythree}{\ytwo+\kay*\yu}% 
\pgfmathsetmacro{\xtwentytwo}{\xtwo-\hay*\xv}% 
 \pgfmathsetmacro{\ytwentytwo}{\ytwo-\hay*\yv}% 
\pgfmathsetmacro{\xtwentythree}{\xtwentytwo+\kay*\xu}% 
 \pgfmathsetmacro{\ytwentythree}{\ytwentytwo+\kay*\yu}% 
\pgfmathsetmacro{\xseventeen}{\xtwentytwo-\xv}% 
 \pgfmathsetmacro{\yseventeen}{\ytwentytwo-\yv}% 
 \pgfmathsetmacro{\xeighteen}{\xseventeen+\kay*\xu}% 
 \pgfmathsetmacro{\yeighteen}{\yseventeen+\kay*\yu}% 
 \pgfmathsetmacro{\xseven}{\xtwo+\hay*\xv}% 
 \pgfmathsetmacro{\yseven}{\ytwo+\hay*\yv}% 
 \pgfmathsetmacro{\xeight}{\xseven+\kay*\xu}% 
 \pgfmathsetmacro{\yeight}{\yseven+\kay*\yu}% 
 \pgfmathsetmacro{\xtwelve}{\xseven+\xv}% 
 \pgfmathsetmacro{\ytwelve}{\yseven+\yv}% 
  \pgfmathsetmacro{\xthirteen}{\xtwelve+\kay*\xu}% 
 \pgfmathsetmacro{\ythirteen}{\ytwelve+\kay*\yu}% 
 \pgfmathsetmacro{\xfour}{\xthree+\hay*\yv}% 
 \pgfmathsetmacro{\yfour}{\ythree-\hay*\xv}% 
 \pgfmathsetmacro{\xnine}{\xfour+\yv}% 
 \pgfmathsetmacro{\ynine}{\yfour-\xv}% 
 \pgfmathsetmacro{\xfourteen}{\xfive+\xv-\yv}% 
 \pgfmathsetmacro{\yfourteen}{\yfive+\xv+\yv}% 
  \coordinate (A1) at (\xone,\yone);
  \coordinate (A2) at (\xtwo,\ytwo);
  \coordinate (A3) at (\xthree,\ythree);
  \coordinate (A4) at (\xfour,\yfour);
  \coordinate (A5) at (\xfive,\yfive);
  \coordinate (A6) at (\xsix,\ysix);  
  \coordinate (A7) at (\xseven,\yseven);
  \coordinate (A8) at (\xeight,\yeight);  
  \coordinate (A9) at (\xnine,\ynine);   
  \coordinate (A10) at (\xten,\yten);    
\coordinate (A11) at (\xeleven,\yeleven);    
\coordinate (A12) at (\xtwelve,\ytwelve);    
\coordinate (A13) at (\xthirteen,\ythirteen);    
\coordinate (A14) at (\xfourteen,\yfourteen);    
\coordinate (A17) at (\xseventeen,\yseventeen);   
\coordinate (A18) at (\xeighteen,\yeighteen);   
\coordinate (A22) at (\xtwentytwo,\ytwentytwo);  
\coordinate (A23) at (\xtwentythree,\ytwentythree);    
  \fill[fill=red] (A14) -- (A5) -- (A6) -- (A11) -- (A10) -- cycle;
  \fill[fill=red] (A6) -- (A17) -- (A22) -- (A1) -- cycle;
  \fill[fill=red] (A17) -- (A18) -- (A23) -- (A22) -- cycle;
 \fill[fill=red] (A7) -- (A8) -- (A13) -- (A12) -- cycle;
 %\draw (A23) -- (A4) -- (A8);
% \draw (A23) .. controls (A14) .. (A4);
 \pgfmathsetmacro{\dee}{\hay*(veclen(\xv,\yv))}% 
 \pgfmathsetmacro{\deetwo}{(\hay+1)*(veclen(\xv,\yv))}% 
 \pgfmathsetmacro{\anglestart}{atan2(\xtwentythree-\xthree,\ytwentythree-\ythree)}%
 \pgfmathsetmacro{\angletarget}{atan2(\xeight-\xthree,\yeight-\ythree)}%
   \fill[fill=red]  (A23) arc (\anglestart:\anglestart+180:\dee) -- (A13) arc (\anglestart+180:\anglestart:\deetwo) -- (A23);
 %\draw[red]  (A23) arc (\angletarget:\anglestart:\dee) -- (A13) arc (\anglestart:\angletarget:\deetwo) -- (A23);
 %\draw[step=0.1cm,gray] (-1,0) grid (15,6);
  %\draw [step=1cm] (-1,0) grid (15,6);
  \begin{scope}[shift=(A5)] %<------------------------- new line
\coordinate (C1) at  (-5,3.4);
\coordinate (C2) at  (-4,4);
\coordinate (C3) at  (-3.6,5);    
\coordinate (C4) at  (-4.5,6);    
\coordinate (C5) at  (-4.7,7);
\coordinate (C6) at  (-4,8);
\coordinate (C7) at  (-3,8.6);
\coordinate (C25) at  (-2.7,9);    
\coordinate (C8) at  (-2.4,10);    
\coordinate (C9) at  (-2.8,11);
\coordinate (C10) at  (-2,11.5);    
\coordinate (C11) at  (-1,12);
\coordinate (C12) at  (-0.3,12.4);   
\coordinate (C13) at  (-0.3,12.6);    
\coordinate (C14) at  (-1,12.2);    
\coordinate (C15) at  (-2,11.7);
\coordinate (C16) at  (-3.1,11);    
\coordinate (C17) at  (-2.6,10);
\coordinate (C18) at  (-2.9,9);    
\coordinate (C26) at  (-4,8.2);
\coordinate (C19) at  (-4.3,8);
\coordinate (C20) at  (-4.9,7);    
\coordinate (C21) at  (-4.7,6);
\coordinate (C22) at  (-3.8,5);   
\coordinate (C23) at  (-4.2,4);    
\coordinate (C24) at  (-5,3.6);   
\filldraw plot [smooth cycle] coordinates { (C1)  (C2)  (C3) (C4) (C5) (C6) (C7) (C25) (C8) (C9) (C10)  
(C11) (C12) (C13) (C14) (C15) (C16) (C17) (C18) (C26) (C19) (C20) (C21) (C22) (C23) (C24)};
\end{scope} %<----------------------- new line
 \fill[fill=red] (A1) -- (A7) -- (A12) -- (A11) -- cycle;
\end{tikzpicture}


\end{document}

在此处输入图片描述

相关内容