绘制折纸模型

绘制折纸模型

我正在使用以下修改后的代码这个帖子

\documentclass[10pt,a4paper]{article}
\usepackage{geometry}
\geometry{a4paper, left=10mm, right=10mm, top=10mm, bottom=10mm}
\usepackage{verbatim}
\usepackage[bookmarks=false,colorlinks,linkcolor=black,urlcolor=blue,citecolor=blue, plainpages=false,pdfpagelabels,breaklinks,linktocpage]{hyperref}
\usepackage{tikz,xparse}
\usetikzlibrary{folding,calc,calendar,decorations,arrows,automata,positioning,mindmap,backgrounds}
\newif\iffill
\begin{document}
\tikzset{%
patron/.style={%
 line join=round, rounded corners=.05pt, draw, thin},
patron side/.style={patron},
patron languette/.style={patron},%
}
\newcounter{NodePat}
\NewDocumentCommand{\PolygReg}{%
O{3}%
O{}
m%
O{A}%
}
{%
\ifx\relax#2\relax
  \iffill
    \ifnum#1=3 \def\tmp{fill=blue!25!white}\else
    \ifnum#1=4 \def\tmp{fill=blue!30!white}\else
    \ifnum#1=5 \def\tmp{fill=blue!35!white}\else
    \ifnum#1=6 \def\tmp{fill=blue!40!white}\else
    \ifnum#1=7 \def\tmp{fill=blue!45!white}\else
    \ifnum#1=8 \def\tmp{fill=blue!50!white}\else
    \def\tmp{}\fi\fi\fi\fi\fi\fi
  \else
    \def\tmp{}
  \fi 
\else
  \def\tmp{#2}
\fi


\foreach \a/\b in {#3} 
{%
\expandafter\path\expandafter[\tmp, patron side] let
\p1 = ($(\a)!.5!(\b)$) ,
\n1 = {veclen(\x1,\y1)} ,
\p2 = ($(\p1)!1/tan(180/#1)!90:(\b)$)
in
(\a)--(\b)
\foreach \i [%
  evaluate=\i as \j using (\i-1)*360/#1] in {3,...,#1} {%
  -- ($(\p2)!1!\j:(\a)$) coordinate (#4\theNodePat)
  \pgfextra{\stepcounter{NodePat}}
  }
-- cycle ;
}
}
\NewDocumentCommand{\Languette}{%
O{.15}  %
D<>{24} %
m       %
D<>{24} %
O{A}
}%
{%
\foreach \b/\a in {#3} {%
\path[patron languette, fill=yellow] let
\p1 = ($(#5\b)!#1/sin(#2)!-#2:(#5\a)$),
\p2 = ($(#5\a)!#1/sin(#4)!#4:(#5\b)$)
in
(#5\a) -- (#5\b) -- (\p1) -- (\p2) -- cycle ; }
}
\makeatletter
\newcommand{\AffNodesPatron}[1][A]{%
 \newcount\X
 \X=1
 \loop
 \expandafter\ifx\csname pgf@sh@pi@A\the\X\endcsname\pgfpictureid
 \node[font={\footnotesize},red] at (A\the\X) {A\the\X} ;
 \advance \X by 1
 \else
 \X=0
 \fi
 \unless\ifnum \X=0
 \repeat
}
\makeatother

\filltrue
\begin{tikzpicture}[scale=2.2, rotate=0]
\coordinate (A1) at (0,0) ;
\coordinate (A2) at (0,-1) ;
\setcounter{NodePat}{3}
\PolygReg{A1/A2,A3/A2,A3/A4,A4/A2,A4/A6,A4/A7}
\PolygReg{A7/A6,A9/A6,A9/A10,A11/A10}
\PolygReg{A9/A11,A9/A13}
\PolygReg{A14/A13,A15/A13,A14/A15,A14/A17,A18/A17}
\PolygReg{A15/A16,A20/A16,A15/A20}
\PolygReg{A20/A21,A20/A23,A24/A23}
\Languette{5/3,2/6,10/12,19/18,13/16,16/21,21/23}
\AffNodesPatron
\draw [thick, white, dashed] (A3.center) -- (A5.center) (A5.center) -- (A6.center) (A2.center) -- (A13.center) (A6.center) -- (A7.center) (A10.center) -- (A12.center) (A18.center) -- (A19.center) (A18.center) -- (A13.center) (A13.center) -- (A22.center) (A13.center) -- (A21.center) (A21.center) -- (A23.center) (A21.center) -- (A22.center);
\draw [draw=none] (A1.center) -- (A2.center) node [purple, pos=.5, xshift=.15cm,yshift=0cm] {\scriptsize\bf G};
\draw [draw=none] (A1.center) -- (A3.center) node [purple, pos=.5, xshift=0cm,yshift=-.2cm] {\scriptsize\bf G};
\draw [draw=none] (A3.center) -- (A5.center) node [purple, pos=.5, xshift=0cm,yshift=.18cm] {\scriptsize\bf H};
\draw [draw=none] (A2.center) -- (A6.center) node [purple, pos=.5, xshift=-.18cm,yshift=0cm] {\scriptsize\bf A};
\draw [draw=none] (A10.center) -- (A12.center) node [purple, pos=.5, xshift=0cm,yshift=.2cm] {\scriptsize\bf G};
\draw [draw=none] (A11.center) -- (A12.center) node [purple, pos=.5, xshift=0cm,yshift=.2cm] {\scriptsize\bf E};
\draw [draw=none] (A6.center) -- (A10.center) node [purple, pos=.5, xshift=0cm,yshift=-.2cm] {\scriptsize\bf A};
\draw [draw=none] (A11.center) -- (A13.center) node [purple, pos=.5, xshift=0cm,yshift=.2cm] {\scriptsize\bf B};
\draw [draw=none] (A13.center) -- (A16.center) node [purple, pos=.5, xshift=-.16cm,yshift=0cm] {\scriptsize\bf B};
\draw [draw=none] (A16.center) -- (A21.center) node [purple, pos=.5, xshift=-.16cm,yshift=0cm] {\scriptsize\bf E};
\draw [draw=none] (A21.center) -- (A23.center) node [purple, pos=.5, xshift=0cm,yshift=-.20cm] {\scriptsize\bf G};
\draw [draw=none] (A23.center) -- (A25.center) node [purple, pos=.5, xshift=0cm,yshift=.20cm] {\scriptsize\bf H};
\draw [draw=none] (A24.center) -- (A25.center) node [purple, pos=.5, xshift=-.18cm,yshift=0cm] {\scriptsize\bf H};
\draw [draw=none] (A18.center) -- (A19.center) node [purple, pos=.5, xshift=0cm,yshift=.18cm] {\scriptsize\bf C};
\end{tikzpicture}
\end{document}

在此处输入图片描述

我正在尝试模仿下面的绘画。

在此处输入图片描述

但我在完成该图表时遇到了困难;因为总是存在第三个点(如 A5、A7、A8、A17、A22)。

绘制剩余的三角形并覆盖这些点,从而创建与它们重叠的另一个节点。

我怎么解决这个问题?

我尝试了许多替代方法来启动和重新排列节点的顺序(包括用六边形替换一些三角形组),但我无法弄清楚如何在不重叠节点的情况下做到这一点。

我也尝试跳过一些内部三角形,但这会留下空的(无色的)三角形,这在打印彩色模型时是不可接受的。

答案1

在你等待更多 Tikz 帮助时,这是你的网络版本元帖子,包裹在 中luamplib。您需要使用 来编译它lualatex

在此处输入图片描述

\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\usepackage{fontspec}
\setmainfont{TeX Gyre Heros}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}

beginfig(1);
    numeric r; r = sqrt(3); 
    path N; 
    N = (0, -6) -- (r, -7) -- (r, -5) -- (r, -3) 
     -- (2r, -2) -- (3r, -1) -- (2r, 0) -- (r, 1) 
     -- (r, 3) -- (r, 5) -- (0, 6);
    N := N & N rotated 180 & cycle;
    N := N scaled 72;

    % draw N withpen pencircle scaled 2 withcolor 3/4;
    % for i=1 upto length N: dotlabel.bot(decimal i, point i of N); endfor
    
    draw for t=0, 2, 18, 6, 4, 14, 16, 8, 12, 10: point t of N -- endfor cycle;

    drawoptions(dashed evenly scaled 2);
    draw for t=19, 3, 17, 7, 13: point t of N -- endfor point 9 of N;
    draw point 3 of N -- point 7 of N;
    draw point 13 of N -- point 17 of N;
    drawoptions();

    vardef flap(expr p, a, r) =
        point 0 of p -- point a of p rotatedabout(point 0 of p, -r)
        -- point 1-a of p rotatedabout (point 1 of p, r) -- point 1 of p
    enddef;

    numeric i; i=0;
    forsuffixes t=H,H,F,f,h,D,c,C,d,h,G,G,a,A,g,E,B,b,e,g:
        picture P;
        if str t < "Z":
            P = thelabel(str t, 7 up);
            draw subpath(i, i+1) of N;
        else:
            P = thelabel(char (ASCII str t - 32), 7 down);
            draw subpath(i, i+1) of N dashed evenly scaled 2;
            draw flap(subpath(i, i+1) of N, 3/16, 28);
        fi
        draw P rotated angle direction i+1/2 of N
            shifted 1/2[point i of N, point incr i of N];
    endfor

    currentpicture := currentpicture rotated 30;
endfig;
\end{mplibcode}
\end{document}

构建后如下所示:

在此处输入图片描述

有关数学细节请参见此处https://en.wikipedia.org/wiki/Octahemioctahedron

代码注释

  • 路径N定义了网络的整体形状,使用普通坐标,并注意如果每个等边三角形的长度为 2,则高度为sqrt(3)
  • 为了避免重复,我将前半部分定义为以原点为中心,这样我就可以通过将其连接到自身旋转来完成形状。
  • 我在直线段中添加了额外的点,因此路径的长度为 20。
  • 然后我可以point t of P根据需要使用该符号绘制所有内部线、实线或虚线。
  • 末端的环作为边缘标记 - 大写字母仅表示标记,小写字母表示翻盖上的标记。
  • 在 MP 中没有优雅的方法来改变大小写,但是char可以ASCII完成工作。
  • incr i末尾的成语巧妙地绕过了路径。
  • 最后,将整个图片旋转,以便打印时能够更整齐地显示在普通卡片上。

您可以通过多种方式控制整个图表的缩放比例:

  • 你可以通过将线更改N := N scaled 72为你想要的任何大小来更改网格的大小。这里的 72 表示 72 个 PostScript 点 = 1 英寸 = 2.54 厘米。所以如果你想要小一点,你可以说N := N scaled 2cm;
  • currentpicture := currentpicture scaled 0.5;你可以在最后添加类似内容来改变整个完成的绘图的大小
  • 您可以在打印时使用您用来查看和打印 PDF 输出的任何软件所提供的打印选项来缩放图片。

如果你想了解更多关于 Metapost 的信息,以便将此图应用于其他网络,你可以关注此链接查找教程和参考手册。我不知道有任何关于绘制网格的具体文章,但有很多关于绘制一般几何图形的文章,可以适用于此特定目的。

更新

彩色版本....

在此处输入图片描述

\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\usepackage{fontspec}
\setmainfont{TeX Gyre Heros}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
input colorbrewer-rgb
beginfig(1);
    numeric r; r = sqrt(3); 
    path N; 
    N = (0, -6) -- (r, -7) -- (r, -5) -- (r, -3) 
     -- (2r, -2) -- (3r, -1) -- (2r, 0) -- (r, 1) 
     -- (r, 3) -- (r, 5) -- (0, 6);
    N := N & N rotated 180 & cycle;
    N := N scaled 72;

    % draw N withpen pencircle scaled 2 withcolor 3/4;
    % for i=1 upto length N: dotlabel.bot(decimal i, point i of N); endfor
    path t; pair u, v;
    t = (origin -- 2 dir -30 -- 2 dir 30 -- cycle) scaled 72;
    u = point 1 of t - point 0 of t;
    v = point 2 of t - point 1 of t;
    vardef trig(expr i, j) = 
        t if not odd i: rotated 60 fi shifted (floor (i/2) * u) shifted (j * v) 
    enddef;
    
    drawoptions(withcolor 3/4[Accent 4 1, white]);
    fill trig( 1,  0);
    fill trig( 1, -3);
    fill trig( 2, -1);
    fill trig(-2,  2);
    fill trig(-2, -1);
    fill trig(-3,  0);
    drawoptions(withcolor 3/4[Accent 4 2, white]);
    fill trig( 1,  2);
    fill trig( 1, -1);
    fill trig( 2,  0);
    fill trig(-2,  1);
    fill trig(-2, -2);
    fill trig(-5, -1);
    drawoptions(withcolor 3/4[Accent 4 3, white]);
    fill trig( 1,  1);
    fill trig( 1, -2);
    fill trig(-3, -1);
    fill trig( 4,  0);
    fill trig(-2,  0);
    fill trig(-2, -3);
    drawoptions(withcolor 3/4[Accent 4 4, white]);
    fill trig( 0, 0);
    fill trig(-1, 1);
    fill trig( 0, 2);
    fill trig(-1,-1);
    fill trig( 0,-2);
    fill trig(-1,-3);

    drawoptions();
    draw for t=0, 2, 18, 6, 4, 14, 16, 8, 12, 10: point t of N -- endfor cycle;

    drawoptions(dashed evenly scaled 2);
    draw for t=19, 3, 17, 7, 13: point t of N -- endfor point 9 of N;
    draw point 3 of N -- point 7 of N;
    draw point 13 of N -- point 17 of N;
    drawoptions();

    vardef flap(expr p, a, r) =
        point 0 of p -- point a of p rotatedabout(point 0 of p, -r)
        -- point 1-a of p rotatedabout (point 1 of p, r) -- point 1 of p
    enddef;

    numeric i; i=0;
    forsuffixes t=H,H,F,f,h,D,c,C,d,h,G,G,a,A,g,E,B,b,e,g:
        picture P;
        if str t < "Z":
            P = thelabel(str t, 7 up);
            draw subpath(i, i+1) of N;
        else:
            P = thelabel(char (ASCII str t - 32), 8 down);
            draw subpath(i, i+1) of N dashed evenly scaled 2;
            draw flap(subpath(i, i+1) of N, 1/4, 28);
        fi
        draw P rotated angle direction i+1/2 of N
            shifted 1/2[point i of N, point incr i of N];
    endfor

    currentpicture := currentpicture rotated 30;
endfig;
\end{mplibcode}
\end{document}

现在迫切需要使其更加通用,但这可能需要一些时间。

答案2

这是使用 TikZ 的自动化解决方案。

我们定义一个新的宏,名为\paperfold。调用顺序为

\paperfold[fill=<color>, <options>]{<triangle sequence>}{<label sequence>}

三角形序列是一个逗号分隔的列表,其中每个条目的形式为x/y/*/*/*,其中x是三角形的水平位置,y是垂直位置。*可以为空(实线)或inward(当前定义为虚线,但可以轻松更改)。

例如,\paperfold[fill=red!30]{1/0/,2/0/,3/0/,2/1/}{}(标签序列为空)将创建 4 个带实线的三角形:底行三个(y=0),顶行一个(y=1)。其他尾随/是可选的。请注意,奇数点的三角形指向上方,偶数点x+y的三角形指向下方。请相应地选择您的序列。x+y

在此处输入图片描述

添加标签序列:

\paperfold[fill=red!30]{1/0/,2/0/,3/0/,2/1/}%
    {A/1/0/tablabel/,C/1/0///tablabel,B/3/0//tablabel/,A/3/0/inlabel/,
    B/2/1//inlabel/,C/2/1///inlabel}

为我们提供了一个四面体的折纸模型。

在此处输入图片描述

标签序列有两种标签inlabeltablabel(标签在内部或标签上)。标签序列是一个逗号分隔的列表,其中每个条目的形式为<label>/x/y/*/*/*。每个*都是标签类型或为空。惯例是,在任何三角形中,水平边是第一个,随后的边从那里开始逆时针方向排列。

您可以向中添加许多选项\paperfold。例如,上面相同的三角形和标签序列可以生成图像

在此处输入图片描述

使用命令

\paperfold[fill=yellow!30,draw=green!50!black,thick,rotate=60]{1/0/,2/0/,3/0/,2/1/}%
    {A/1/0/tablabel/,C/1/0///tablabel,B/3/0//tablabel/,A/3/0/inlabel/,
    B/2/1//inlabel/,C/2/1///inlabel}

这是八面体的代码:

\paperfold[fill=blue!30]{5/1//inward/inward,6/1/inward//inward,7/1/,8/1/,
    4/2/inward/inward/,5/2/,6/2/inward//inward,7/2///inward,
    0/3///inward,1/3/,2/3//inward/,3/3//inward/inward,4/3/inward//inward,5/3/,6/3/inward/inward/,7/3//inward/inward,
    1/4//inward/,2/4/inward/inward/,3/4/,4/4/inward//inward,5/4//inward/inward,6/4/inward/inward/,7/4/,8/4///inward,
    1/5//inward/inward,2/5/inward//inward,3/5/,4/5/inward//,
    0/6/,1/6/,2/6/inward//inward,3/6//inward/inward}%
    {E/5/1//tablabel/,G2/6/1/tablabel/,H2/8/1/inlabel/,H1/8/1//inlabel/,
    B/4/2//tablabel/,F/7/2//inlabel/,
    G1/0/3///tablabel,E/0/3/inlabel/,B/2/3/inlabel/,F/7/3///tablabel,
    A/1/4///inlabel,C/6/4/tablabel/,D/8/4/inlabel/,H1/8/4///tablabel,
    A/1/5//tablabel/,C/4/5//inlabel/,
    G2/0/6/inlabel/,G1/0/6//inlabel/,H2/2/6/tablabel/,D/3/6//tablabel/}

在此处输入图片描述

请注意,为了在内部获得虚线,两个都必须为虚线相邻的三角形提供密钥inward

这是完整的代码,包括上面的示例。

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathreplacing}

\tikzset{inward/.style={dashed}}
\tikzset{
    tablabel/.style={
        decoration={
            show path construction,
            lineto code={
                \path (\tikzinputsegmentfirst); \pgfgetlastxy{\a}{\b};
                \path (\tikzinputsegmentlast); \pgfgetlastxy{\x}{\y};
                \coordinate (uu) at ($(0,0)!2mm!(\b-\y,\x-\a)$);
                \coordinate (uv) at ($(0,0)!4mm!(\x-\a,\y-\b)$);
                \draw(\a,\b)--($(\a,\b)-(uu)+(uv)$) to node[above=-.9mm,sloped,allow upside down]{\tiny \textsf{#1}} ($(\x,\y)-(uu)-(uv)$)--(\x,\y);
            }
        }, decorate
    } 
}
\tikzset{
    inlabel/.style={
        decoration={
            show path construction,
            lineto code={
                \path(\tikzinputsegmentfirst) to node[above=-.9mm,sloped,allow upside down]{\tiny \textsf{#1}} (\tikzinputsegmentlast);
            }
        }, decorate
    } 
}

\newcommand{\paperfold}[3][]{\begin{tikzpicture}[line cap=round, #1]
    \foreach \x/\y/\sa/\sb/\sc in {#2} {
        \begin{scope}[yscale=sqrt(3),rotate around={180*(\x+\y+1):(\x,\y+.5)}]
            \fill (\x-1,\y)--(\x+1,\y)--(\x,\y+1)--cycle;
            \draw[\sa](\x-1,\y)--(\x+1,\y);
            \draw[\sb](\x+1,\y)--(\x,\y+1);
            \draw[\sc](\x,\y+1)--(\x-1,\y);
        \end{scope}
    }
    \foreach \z/\x/\y/\ta/\tb/\tc in {#3} {
        \begin{scope}[yscale=sqrt(3),rotate around={180*(\x+\y+1):(\x,\y+.5)}]
            \path[\ta=\z](\x-1,\y)--(\x+1,\y);
            \path[\tb=\z](\x+1,\y)--(\x,\y+1);
            \path[\tc=\z](\x,\y+1)--(\x-1,\y);
        \end{scope}
    }
\end{tikzpicture}}


\begin{document}

\paperfold[fill=red!30]{1/0/,2/0/,3/0/,2/1/}{}

\paperfold[fill=red!30]{1/0/,2/0/,3/0/,2/1/}%
    {A/1/0/tablabel/,C/1/0///tablabel,B/3/0//tablabel/,A/3/0/inlabel/,B/2/1//inlabel/,C/2/1///inlabel}

\paperfold[fill=yellow!30,draw=green!50!black,thick,rotate=60]{1/0/,2/0/,3/0/,2/1/}%
    {A/1/0/tablabel/,C/1/0///tablabel,B/3/0//tablabel/,A/3/0/inlabel/,B/2/1//inlabel/,C/2/1///inlabel}

\paperfold[fill=blue!30]{5/1//inward/inward,6/1/inward//inward,7/1/,8/1/,
    4/2/inward/inward/,5/2/,6/2/inward//inward,7/2///inward,
    0/3///inward,1/3/,2/3//inward/,3/3//inward/inward,4/3/inward//inward,5/3/,6/3/inward/inward/,7/3//inward/inward,
    1/4//inward/,2/4/inward/inward/,3/4/,4/4/inward//inward,5/4//inward/inward,6/4/inward/inward/,7/4/,8/4///inward,
    1/5//inward/inward,2/5/inward//inward,3/5/,4/5/inward//,
    0/6/,1/6/,2/6/inward//inward,3/6//inward/inward}%
    {E/5/1//tablabel/,J/6/1/tablabel/,K/8/1/inlabel/,H/8/1//inlabel/,
    B/4/2//tablabel/,F/7/2//inlabel/,
    G/0/3///tablabel,E/0/3/inlabel/,B/2/3/inlabel/,F/7/3///tablabel,
    A/1/4///inlabel,C/6/4/tablabel/,D/8/4/inlabel/,H/8/4///tablabel,
    A/1/5//tablabel/,C/4/5//inlabel/,
    J/0/6/inlabel/,G/0/6//inlabel/,K/2/6/tablabel/,D/3/6//tablabel/}

\end{document}

答案3

我要感谢 Thruston 和 Sandy G 使用 Metapost 和 paperfold 宏提供的出色答案。我非常感谢他们的努力、关注和时间。

但是我需要一个可以在使用此代码绘制其他多面体时应用的答案;并且这些答案仅针对当前情况。

因此,我找到了解决我的问题的方法,即留下可以手动填充的空白区域;如以下代码所示。我用不同的颜色填充了这些空白区域,只是为了说明我的观点。

\documentclass[10pt,a4paper]{article}
\usepackage{geometry}
\geometry{a4paper, left=10mm, right=10mm, top=10mm, bottom=10mm}
\usepackage{verbatim}
\usepackage[bookmarks=false,colorlinks,linkcolor=black,urlcolor=blue,citecolor=blue, plainpages=false,pdfpagelabels,breaklinks,linktocpage]{hyperref}
\usepackage{tikz,xparse}
\usetikzlibrary{folding,calc,calendar,decorations,arrows,automata,positioning,mindmap,backgrounds}
\newif\iffill
\fillfalse
\begin{document}
\tikzset{%
patron/.style={%
 line join=round, rounded corners=.05pt, draw, thin},
patron side/.style={patron},
patron languette/.style={patron},%
}
\newcounter{NodePat}
\NewDocumentCommand{\PolygReg}{%
O{3}%
O{}
m%
O{A}%
}
{%
\ifx\relax#2\relax
  \iffill
    \ifnum#1=3 \def\tmp{fill=blue!25!white}\else
    \ifnum#1=4 \def\tmp{fill=blue!30!white}\else
    \ifnum#1=5 \def\tmp{fill=blue!35!white}\else
    \ifnum#1=6 \def\tmp{fill=blue!40!white}\else
    \ifnum#1=7 \def\tmp{fill=blue!45!white}\else
    \ifnum#1=8 \def\tmp{fill=blue!50!white}\else
    \def\tmp{}\fi\fi\fi\fi\fi\fi
  \else
    \def\tmp{}
  \fi 
\else
  \def\tmp{#2}
\fi
\foreach \a/\b in {#3} 
{%
\expandafter\path\expandafter[\tmp, patron side] let
\p1 = ($(\a)!.5!(\b)$) ,
\n1 = {veclen(\x1,\y1)} ,
\p2 = ($(\p1)!1/tan(180/#1)!90:(\b)$)
in
(\a)--(\b)
\foreach \i [%
  evaluate=\i as \j using (\i-1)*360/#1] in {3,...,#1} {%
  -- ($(\p2)!1!\j:(\a)$) coordinate (#4\theNodePat)
  \pgfextra{\stepcounter{NodePat}}
  }
-- cycle ;
}
}
\NewDocumentCommand{\Languette}{%
O{.15}  %
D<>{24} %
m       %
D<>{24} %
O{A}
}%
{%
\foreach \b/\a in {#3} {%
\path[patron languette, fill=yellow] let
\p1 = ($(#5\b)!#1/sin(#2)!-#2:(#5\a)$),
\p2 = ($(#5\a)!#1/sin(#4)!#4:(#5\b)$)
in
(#5\a) -- (#5\b) -- (\p1) -- (\p2) -- cycle ; }
}
\makeatletter
\newcommand{\AffNodesPatron}[1][A]{%
 \newcount\X
 \X=1
 \loop
 \expandafter\ifx\csname pgf@sh@pi@A\the\X\endcsname\pgfpictureid
 \node[font={\footnotesize},red] at (A\the\X) {A\the\X} ;
 \advance \X by 1
 \else
 \X=0
 \fi
 \unless\ifnum \X=0
 \repeat
}
\makeatother

Octahemioctahedron

\fillfalse
\hskip -1.2cm
\begin{tikzpicture}[scale=3.8, rotate=0]
\coordinate (A1) at (0,0) ;
\coordinate (A2) at (0,-1) ;
\setcounter{NodePat}{3}
\PolygReg[3][fill=blue!20!white]{A1/A2,A3/A2,A3/A4,A4/A2,A4/A6,A4/A7}
\PolygReg[3][fill=blue!20!white]{A7/A6,A9/A6,A9/A10,A11/A10}
\PolygReg[3][fill=blue!20!white]{A9/A11,A9/A13}
\PolygReg[3][fill=blue!20!white]{A14/A13,A15/A13,A14/A15,A14/A17,A18/A17,A19/A17}
\PolygReg[3][fill=blue!20!white]{A15/A16,A21/A16,A15/A21}
\PolygReg[3][fill=blue!20!white]{A21/A22,A21/A24,A25/A24,A19/A20}
\Languette{5/3,8/5,2/6,10/12,19/18,13/16,16/22,23/20,22/24,20/27}
\AffNodesPatron

\draw [draw=none,fill=blue!15!white] (A5.center) -- (A4.center) -- (A8.center);
\draw [draw=none,fill=blue!15!white] (A8.center) -- (A9.center) -- (A14.center) -- (A18.center);
\draw [draw=none,fill=blue!15!white] (A21.center) -- (A23.center) -- (A25.center);
\draw [draw=none,fill=blue!15!white] (A15.center) -- (A17.center) -- (A20.center) -- (A23.center);

\draw [thick, white, dashed] (A3.center) -- (A5.center) (A5.center) -- (A6.center) (A2.center) -- (A13.center) (A6.center) -- (A7.center) (A10.center) -- (A12.center) (A18.center) -- (A17.center) (A18.center) -- (A19.center) (A18.center) -- (A13.center) (A13.center) -- (A23.center) (A13.center) -- (A22.center) (A22.center) -- (A24.center) (A22.center) -- (A27.center) (A5.center) -- (A8.center);

\draw [thick, black, dashed] (A17.center) -- (A23.center) (A7.center) -- (A18.center);

\draw [thick, black] (A23.center) -- (A25.center) (A8.center) -- (A18.center) (A14.center) -- (A7.center) ;

\draw [draw=none] (A2.center) -- (A6.center) node [purple, pos=.5, xshift=-.18cm,yshift=0cm] {\scriptsize\bf A};
\draw [draw=none] (A6.center) -- (A10.center) node [purple, pos=.5, xshift=0cm,yshift=-.2cm] {\scriptsize\bf A};
\draw [draw=none] (A11.center) -- (A13.center) node [purple, pos=.5, xshift=0cm,yshift=.2cm] {\scriptsize\bf B};
\draw [draw=none] (A13.center) -- (A16.center) node [purple, pos=.5, xshift=-.16cm,yshift=0cm] {\scriptsize\bf B};
\draw [draw=none] (A18.center) -- (A19.center) node [purple, pos=.5, xshift=0cm,yshift=.18cm] {\scriptsize\bf C};
\draw [draw=none] (A18.center) -- (A8.center) node [purple, pos=.5, xshift=-.18cm,yshift=0cm] {\scriptsize\bf C};
\draw [draw=none] (A27.center) -- (A19.center) node [purple, pos=.5, xshift=0cm,yshift=-.18cm] {\scriptsize\bf D};
\draw [draw=none] (A5.center) -- (A8.center) node [purple, pos=.5, xshift=.18cm,yshift=0cm] {\scriptsize\bf D};
\draw [draw=none] (A11.center) -- (A12.center) node [purple, pos=.5, xshift=0cm,yshift=.2cm] {\scriptsize\bf E};
\draw [draw=none] (A16.center) -- (A22.center) node [purple, pos=.5, xshift=-.16cm,yshift=0cm] {\scriptsize\bf E};
\draw [draw=none] (A1.center) -- (A2.center) node [purple, pos=.5, xshift=.15cm,yshift=0cm] {\scriptsize\bf G};
\draw [draw=none] (A20.center) -- (A23.center) node [purple, pos=.5, xshift=0cm,yshift=-.2cm] {\scriptsize\bf F};
\draw [draw=none] (A25.center) -- (A23.center) node [purple, pos=.5, xshift=-.18cm,yshift=0cm] {\scriptsize\bf F};
\draw [draw=none] (A1.center) -- (A3.center) node [purple, pos=.5, xshift=0cm,yshift=-.2cm] {\scriptsize\bf G};
\draw [draw=none] (A10.center) -- (A12.center) node [purple, pos=.5, xshift=0cm,yshift=.2cm] {\scriptsize\bf G};
\draw [draw=none] (A22.center) -- (A24.center) node [purple, pos=.5, xshift=0cm,yshift=-.20cm] {\scriptsize\bf G};
\draw [draw=none] (A3.center) -- (A5.center) node [purple, pos=.5, xshift=0cm,yshift=.18cm] {\scriptsize\bf H};
\draw [draw=none] (A24.center) -- (A26.center) node [purple, pos=.5, xshift=0cm,yshift=.20cm] {\scriptsize\bf H};
\draw [draw=none] (A25.center) -- (A26.center) node [purple, pos=.5, xshift=-.18cm,yshift=0cm] {\scriptsize\bf H};
\draw [draw=none] (A20.center) -- (A27.center) node [purple, pos=.5, xshift=0cm,yshift=-.2cm] {\scriptsize\bf H};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容