刚开始学习群论,希望能画出正多边形的旋转和反射对称。从网站上获取了以下代码,无法将其拼凑起来得到我需要的东西,尤其是开放的弯曲箭头。researchgate.net 有等边三角形的对称性,但受版权保护。如果有人可以在 Tikz 中将它们制作出来供大家使用,那就太好了。如果没有制作所有多边形的代码,只需一个正方形的代码就好了。
% !TeX spellcheck = en_GB
\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, calc}
\usetikzlibrary{shapes.arrows, fadings}
\begin{document}
\begin{tikzpicture}[scale=3 ]
\def\rps{4} % regular polygon sides
\node (a)
[draw, blue!0!black,rotate=0,minimum size=3cm,regular polygon, fill=blue!25, regular polygon sides=\rps ] at (0, 0) {};
\foreach \x in {1,2,...,\rps}{
\draw [black,dashed, shorten <=-0.75cm,shorten >=-0.75cm](a.center) -- (a.side \x);
\draw [black,dashed, shorten <=-0.75cm,shorten >=-0.75cm](a.center) -- (a.corner \x);}
\end{tikzpicture}
\begin{tikzpicture}[every node/.append style={ draw=white, left color=white, double arrow}]
\node [
right color=blue,
double arrow,
minimum height=1.5cm
] {};
\end{tikzpicture}
\end{document}
答案1
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{arrows.meta}
\makeatletter
\tikzset{
a/.style={
double=green!10,
double distance=2pt,
draw=teal!50,
},
foo /.tip={Stealth[inset=0pt, length=4pt, width=6pt, fill=green!10]},
pics/arc arrow/.style args={#1:#2:#3}{
code={
\draw[a, -foo] (0, 0) arc (#1:#2:#3) coordinate (arc@temp);
\path (arc@temp) ++(270+#2:4pt) ++(#2:3pt) coordinate (-a);
}
},
pics/straight arrow/.style={
code={
\begin{scope}[rotate=#1]
\draw[a, foo-foo] (0, -0.5) -- (0, 0.5);
\fill[green!10] (-1pt, 0.5cm-4.1pt) rectangle (1pt, 0.5cm-3.9pt+\pgflinewidth);
\fill[green!10] (1pt, -0.5cm+4.1pt) rectangle (-1pt, -0.5cm+3.9pt-\pgflinewidth);
\coordinate (-a) at (3pt, -0.5cm + 4pt);
\end{scope}
}
},
mydash/.style={dash pattern=on 2mm off 0.5mm}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\path[draw=blue!80, fill=purple!30] (-2, -2) rectangle (2, 2);
\foreach \i in {0, 45, ..., 315} {
\draw[mydash] (0, 0) -- (\i:4);
}
\foreach \r/\t/\p [count=\i] in {90/r/above right, 135/s/above left, 180/t/left, 225/u/below left} {
\pic (arrow\i) at (\r:3.4cm) {straight arrow=\r};
\node[\p, inner sep=1pt] at (arrow\i-a) {$\t$};
}
\foreach \x/\r/\t/\p [count=\i] in {0.4/360/c/right, 0.8/270/b/below left, 1.2/180/a/above left} {
\pic (arc\i) at (0, \x) {arc arrow=90:\r:\x cm};
\node[\p, inner sep=1pt] at (arc\i-a) {$\t$};
}
\end{tikzpicture}
\end{document}
答案2
这是一个\poly
显示正多边形任意边数的旋转的命令。
bending library
标记最大角度旋转的内箭头(仅适用于五边形)存在一个小问题,我还没有解决,因为和之间似乎不兼容double arrows
。
更新:箭头从 12 点开始
\documentclass{article}
\usepackage{tikz}
%\usetikzlibrary {bending}
\usetikzlibrary{math,calc}
\usetikzlibrary{shapes.geometric,shapes.arrows,arrows.meta}
\usepackage{alphalph}
\newcommand\poly[1]{
\begin{tikzpicture}[auto=right,>={Triangle[open,fill=white,length=4pt,angle=60:1pt 2,inset=0pt]}]
% regular polygon sides
\def\rps{#1}
% rayon du cercle circonscrit
\def\rayonext{2.5cm}
% couleur de fond du polygone
\def\couleur{blue!25}
% nombre de rotations
\pgfmathsetmacro\nbrotation{int(\rps-1)}
% rayon du cercle inscrit
\pgfmathsetmacro\rayonint{multiply(\rayonext,cos(180/\rps))}
% % definition de l'angle de départ des flèches des rotations
\pgfmathsetmacro\startarrow{90}
\node (a)
[draw,blue!0!black,rotate=0,minimum size=2*\rayonext,regular polygon,fill=\couleur,regular polygon sides=\rps] at (0, 0) {};
\foreach \x in {1,...,\rps}{
\draw [black,dashed, shorten >=-1.5cm,shorten <=0cm](a.center) -- (a.side \x);
\draw [black,dashed, shorten >=-0.75cm,shorten <=0cm](a.center) -- (a.corner \x);
}
\foreach \i in {1,...,\rps}{
\draw[<->,double distance=1.4pt] ({\startarrow+(\i-1)*180/\rps}:\rayonext+5mm) ++([rotate=\startarrow+90+(\i-1)*180/\rps]-4mm,0) -- ++([rotate=\startarrow+90+(\i-1)*180/\rps]8mm,0)node[pos=.02,auto=right,outer sep=2pt,inner sep=1pt,]{\alphalph{\i+17}};
}
\foreach \i [evaluate=\i as \ratio using \i/\rps] in {1,...,\nbrotation}{
\draw [->,double distance=1.4pt]
($(a.center)!\rayonint pt!(a.90)!\ratio!(a.center)$)arc[start angle=\startarrow,delta angle=360*\ratio,radius={\rayonint pt*(1-\ratio)}]
node[pos=.98,auto=right,outer sep=2pt,inner sep=0pt,node font=small,font=\bf,fill=\couleur,text=white]{\alphalph{\i}};
}
\end{tikzpicture}
}
\begin{document}
\poly{3}
\qquad
\poly{4}
\bigskip
\bigskip
\poly{5}\qquad
\poly{6}
\end{document}
旧答案:箭头从线段平分线开始
\documentclass{article}
\usepackage{tikz}
%\usetikzlibrary {bending}
\usetikzlibrary{math,calc}
\usetikzlibrary{shapes.geometric,shapes.arrows,arrows.meta}
\usepackage{alphalph}
\newcommand\poly[1]{
\begin{tikzpicture}[auto=right,>={Triangle[open,fill=white,length=4pt,angle=60:1pt 2,inset=0pt]}]
% regular polygon sides
\def\rps{#1}
% rayon du cercle circonscrit
\def\rayonext{2.5cm}
% couleur de fond du polygone
\def\couleur{blue!25}
% nombre de rotations
\pgfmathsetmacro\nbrotation{int(\rps-1)}
% rayon du cercle inscrit
\pgfmathsetmacro\rayonint{multiply(\rayonext,cos(180/\rps))}
% definition de l'angle de départ des flèches des rotations
\pgfmathparse{iseven(\rps)} \pgfmathresult
\ifnum \pgfmathresult=1
\pgfmathsetmacro\startarrow{90}
\else
\pgfmathsetmacro\startarrow{90+180/\rps}
\fi
\node (a)
[draw,blue!0!black,rotate=0,minimum size=2*\rayonext,regular polygon,fill=\couleur,regular polygon sides=\rps] at (0, 0) {};
\foreach \x in {1,...,\rps}{
\draw [black,dashed, shorten >=-1.5cm,shorten <=0cm](a.center) -- (a.side \x);
\draw [black,dashed, shorten >=-0.75cm,shorten <=0cm](a.center) -- (a.corner \x);
}
\foreach \i in {1,...,\rps}{
\draw[<->,double distance=1.4pt] ({\startarrow+(\i-1)*180/\rps}:\rayonext+5mm) ++([rotate=\startarrow+90+(\i-1)*180/\rps]-4mm,0) -- ++([rotate=\startarrow+90+(\i-1)*180/\rps]8mm,0)node[pos=.02,auto=right,outer sep=2pt,inner sep=1pt,]{\alphalph{\i+17}};
}
\foreach \i [evaluate=\i as \ratio using \i/\rps] in {1,...,\nbrotation}{
\draw [->,double distance=1.4pt]
($(a.side 1)!\ratio!(a.center)$)arc[start angle=\startarrow,delta angle=360*\ratio,radius={\rayonint pt*(1-\ratio)}]
node[pos=.98,auto=right,outer sep=2pt,inner sep=0pt,node font=small,font=\bf,fill=\couleur,text=white]{\alphalph{\i}};
}
\end{tikzpicture}
}
\begin{document}
\poly{3}\qquad
\poly{4}
\bigskip
\bigskip
\poly{5}\qquad
\poly{6}
\end{document}