我必须绘制一系列正多边形(实际上是等角多边形),每个多边形都是通过三等分前一个多边形的边并随后切掉其角而构成的。
现在我正在手动输入每个多边形的所有坐标:
\begin{tabular}{c c c c c}
\begin{tikzpicture}
\coordinate (E) at (0.1,0);
\coordinate (F) at (2.1,0);
\coordinate (G) at ($(F)+(120:2cm)$);
\coordinate (eg1) at ($(E)+(0:0.666cm)$);
\coordinate (eg2) at ($(E)+(0:1.333cm)$);
\coordinate (gf1) at ($(F)+(120:0.666cm)$);
\coordinate (gf2) at ($(F)+(120:1.333cm)$);
\coordinate (ef1) at ($(E)+(60:0.666cm)$);
\coordinate (ef2) at ($(E)+(60:1.333cm)$);
\draw (-2.1,0) -- (-0.1,0) -- ++(120:2cm) -- cycle;
\draw (-2.1,0)++(60:0.666cm) -- +(150:1pt) -- +(150:-1pt);
\draw (-2.1,0)++(60:1.333cm) -- +(150:1pt) -- +(150:-1pt);
\draw (-2.1,0)++(0:0.666cm) -- +(90:1pt) -- +(90:-1pt);
\draw (-2.1,0)++(0:1.333cm) -- +(90:1pt) -- +(90:-1pt);
\draw (-0.1,0)++(120:0.666cm) -- +(210:1pt) -- +(210:-1pt);
\draw (-0.1,0)++(120:1.333cm) -- +(210:1pt) -- +(210:-1pt);
\end{tikzpicture} %
\begin{tikzpicture}
\coordinate (E) at (0.1,0);
\coordinate (F) at (2.1,0);
\coordinate (G) at ($(F)+(120:2cm)$);
\coordinate (eg1) at ($(E)+(0:0.666cm)$);
\coordinate (eg2) at ($(E)+(0:1.333cm)$);
\coordinate (gf1) at ($(F)+(120:0.666cm)$);
\coordinate (gf2) at ($(F)+(120:1.333cm)$);
\coordinate (ef1) at ($(E)+(60:0.666cm)$);
\coordinate (ef2) at ($(E)+(60:1.333cm)$);
\coordinate (p) at ($(ef1)+(120:-0.222cm)$);
\coordinate (q) at ($(ef1)+(60:0.222cm)$);
\coordinate (r) at ($(ef1)+(120:-0.444cm)$);
\coordinate (s) at ($(ef1)+(60:0.444cm)$);
\draw (eg1)--(eg2)--(gf1)--(gf2)--(ef2) --(ef1)--cycle;
\draw (p)--+(210:1pt)--+(210:-1pt);
\draw (q)--+(150:1pt)--+(150:-1pt);
\draw (r)--+(210:1pt)--+(210:-1pt);
\draw (s)--+(150:1pt)--+(150:-1pt);
\end{tikzpicture}&%
&%
&%
&
\begin{tikzpicture}
\draw circle (0.566cm);
\end{tikzpicture}
\end{tabular}
现在我只放入了两个这样的多边形,因为它实在是太繁琐了:
有没有办法“自动化”这个过程?比如使用一些\foreach
表达式或类似的东西?到目前为止我还没找到。
答案1
您所描述的过程仅提供了两个正多边形,三角形和六边形。以下构造的所有多边形都不会是等边的,也就是说,它们的边长会有所不同。如果这是内涵,这里有一种使用 Asymptote 来实现的方法:
// trisectpoly.asy
// run
// asy trisectpoly.asy
// to get trisectpoly.pdf
settings.tex="pdflatex";
import graph;
size(9cm);
pen linePen=darkblue+0.7bp;
pair[] f(pair[] p){
pair[] q;
for(int i=0;i<p.length;++i){
q.push((2p[i]+ p[i+1])/3);
q.push(( p[i]+2p[i+1])/3);
}
q.cyclic=true;
return q;
}
real a=1;
pair[]p={0,(a,0),a/2*(1,sqrt(3))};
p.cyclic=true;
draw(graph(p)--cycle,linePen);
int n=10;
for(int i=0;i<n;++i){
p=f(p);
draw(shift((i+1)*a)*(graph(p)--cycle),linePen);
}
答案2
这是建议。标记由标记设置,坐标设置在边缘的 1/3 和 2/3 位置。您可以根据需要迭代此操作,我已经将下一个坐标的定义放入其中。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings}
\tikzset{mymark/.style={postaction={decorate,
decoration={markings,mark=at position 1/3 with {\draw(0,-2pt)--(0,2pt);},
mark=at position 2/3 with {\draw(0,-2pt)--(0,2pt);}}
}}}
\begin{document}
\begin{tabular}{c c c c c}
\begin{tikzpicture}
\coordinate (E) at (-30:1cm);
\coordinate (F) at (90:1cm);
\coordinate (G) at (210:1cm);
\foreach \X/\Y in {E/F,F/G,G/E}
{
\draw[mymark] (\X)--(\Y) coordinate[pos={1/3}] (\X 1\Y) coordinate[pos={2/3}] (\X 2\Y);
% the coordinates are not needed at this stage
}
\end{tikzpicture} %
&
\begin{tikzpicture}
\coordinate (E) at (-30:1cm);
\coordinate (F) at (90:1cm);
\coordinate (G) at (210:1cm);
\foreach \X/\Y in {E/F,F/G,G/E}
{
\path (\X)--(\Y) coordinate[pos={1/3}] (\X 1\Y) coordinate[pos={2/3}] (\X 2\Y);
}
\foreach \X/\Y/\Z in {E/F/G,F/G/E,G/E/F}
{\draw[mymark] (\X 2\Y)--(\Y 1\Z)
coordinate[pos={1/3}] (\X\Y\Z 1) coordinate[pos={2/3}] (\X\Y\Z 2);
% the coordinates are not needed at this stage
\draw[mymark] (\X 1\Y)--(\X 2\Y)
coordinate[pos={1/3}] (\X\Y 1) coordinate[pos={2/3}] (\X\Y 2); }
% the coordinates are not needed at this stage
% but define the corners of the next contour
\end{tikzpicture} %
%
&%
&%
&
\begin{tikzpicture}
\draw circle (0.566cm);
\end{tikzpicture}
\end{tabular}
\end{document}