我如何才能将一组圆圈(我的情况是红色圆圈)均匀分布在极坐标阵列中?如果需要,大红圈和白圈之间的中心距离为 4.267 厘米。非常感谢您的建议!
代码在这里,
\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\begin{picture}(215,100)(0,0)
\begin{tikzpicture}
\filldraw[color=black](100,50) circle(7cm);
\filldraw[color=white](100,50) circle(1.8cm);
\filldraw[color=red](104.267, 50) circle(0.962cm);
\begin{scope}[shift={(104.267,50)}]
\foreach \x in {60,120,...,360} {\filldraw[color=red](\x:1.633) circle(0.45cm); }
\end{scope}
\end{tikzpicture}
\end{picture}
\end{figure}
\end{document}
答案1
我假设您想要将红色圆圈组(由一个大圆圈和六个小圆圈组成)均匀分布在中心点周围,方式类似于第 35 页所述此 AutoCAD 讲义。
这是我的建议:
\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\begin{picture}(215,100)(0,0)
\begin{tikzpicture}
%These are the parameters from the AutoCAD "Polar Array" dialog:
%"Total number of items"
\def\n{4};
%"Angle to fill"
\def\nangle{360};
%"Rotate items as copied" (1 = yes; 0 = no)
\def\rbool{1};
%Optional angle for the position of the first set
\def\nstart{0};
%Number of small circles
\def\k{6};
\pgftransformshift{ \pgfpoint{100}{50} };
\filldraw[color=black](0,0) circle(7cm);
\filldraw[color=white](0,0) circle(1.8cm);
\foreach \a in {1,...,\n} {
\pgftransformshift{ \pgfpointpolar{(\a-1)*\nangle/\n+\nstart}{4.3cm} }
\pgftransformrotate{ (\a-1)*\nangle/\n*\rbool }
\filldraw[color=red] (0,0) circle(.96cm);
\foreach \x in {1,...,\k} {
\filldraw[color=red,]+(\x*360/\k:1.633) circle(0.43cm);
}
}
\end{tikzpicture}
\end{picture}
\end{figure}
\end{document}
输出如下:
答案2
具有 »tikZ« 语法的解决方案。迭代应该是可以理解的。只需根据您的需要调整以下示例即可。
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill[black](0,0) circle (7cm);
\fill[white](0,0) circle (2cm);
\foreach \r in {72,144,...,360} {%
\begin{scope}[red,shift={(\r:4.5)}]
\fill (0,0) circle (1cm);
\foreach \x in {72,144,...,360} {%
\begin{scope}[shift={(\x:1.75)}]
\fill (0,0) circle (0.5cm);
\end{scope}
};
\end{scope}
};
\end{tikzpicture}
\end{document}
这pgf/tikZ手册中有关于所涉及命令的更多详细信息。
答案3
只是为了分享以防有人需要。代码显示了四个具有不同配置的板。可能需要一点 texkeeping(有这样的词吗?)再次感谢大家的帮助!
\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\begin{picture}(215,20)(0,0)
\begin{tikzpicture}
\pgftransformshift{\pgfpoint{100}{0}}; % shift of (0,0) coordinate
\filldraw[scale=0.2,color=black](0,0) circle(7cm); % plate
\filldraw[scale=0.2,color=white](0,0) circle(0.6505cm); % 1stlevelcircle
\foreach \x in {60,120,...,360} {\filldraw[scale=0.2,color=white](\x:1.9) circle(0.6505cm);
\foreach \x in {30,60,...,360} {\filldraw[scale=0.2,color=white](\x:3.8) circle(0.6505cm);
\foreach \x in {18,36,...,360} {\filldraw[scale=0.2,color=white](\x:5.7) circle(0.6505cm);
}
}
}
%F0F0F0F0F0
\pgftransformshift{\pgfpoint{90}{0}};
\filldraw[scale=0.2,color=black](0,0) circle(7cm);
\filldraw[scale=0.2,color=white](0,0) circle(2.5cm);
\foreach \x in {60,120,...,360}{\filldraw[scale=0.2,color=white](\x:4.755) circle(1.28cm); }
%F1F1F1F1F1
\def\n{6}; %"Total number of items"
\def\nangle{360}; %"Angle to fill"
\def\rbool{1}; %"Rotate items as copied" (1 = yes; 0 = no)
\def\nstart{0} ;%Optional angle for the position of the first set
\def\k{6}; %Number of small circles
\pgftransformshift{\pgfpoint{90}{0}};
\filldraw[scale=0.2,color=black](0,0) circle(7cm);
\filldraw[scale=0.2,color=white](0,0) circle(1.8cm);
\foreach \a in {1,...,\n} {
\pgftransformshift{\pgfpointpolar{(\a-1)*\nangle/\n+\nstart}{0.86cm}}
\pgftransformrotate{(\a-1)*\nangle/\n*\rbool}
\filldraw[scale=0.2,color=white](0,0) circle(.96cm); %4.3*0.2=0.86
\foreach \x in {1,...,\k} {
\filldraw[scale=0.2,color=white]+(\x*360/\k:1.633) circle(0.43cm);
}
}
%%F2F2F2F2F2
\pgftransformshift{\pgfpoint{90}{0}}; % shift of (0,0) coordinate
\filldraw[scale=0.2,color=black](0,0) circle(7cm); % plate
\filldraw[scale=0.2,color=white](0,0) circle(1.4cm); % 1stlevelcircle
\foreach \m in {1,...,\n} {\filldraw[scale=0.2,color=white,]+(\m*360/\k+27:6.130) circle(0.15cm); }
\foreach \m in {1,...,\n} {\filldraw[scale=0.2,color=white,]+(\m*360/\k+32:6.130) circle(0.15cm); }
\foreach \a in {1,...,\n} {
\pgftransformshift{\pgfpointpolar{(\a-1)*\nangle/\n+\nstart}{0.8146cm}}
\pgftransformrotate{(\a-1)*\nangle/\n*\rbool} %rotation degree and %4.073*0.2=0.8146
\filldraw[scale=0.2,color=white] (0,0) circle(.736cm); % 2ndlevelcircle
\foreach \i in {1,...,\n} {
\pgftransformshift{\pgfpointpolar{(\i-1)*\nangle/\n+\nstart}{0.297cm}}
\pgftransformrotate{(\i-1)*\nangle/\n*\rbool} %rotation degree and %1.485*0.2=0.297
\filldraw[scale=0.2,color=white] (0,0) circle(.4cm); % 3rdlevelcircle
\foreach \x in {1,...,\k} {
\filldraw[scale=0.2,color=white]+(\x*360/\k+30:.63) circle(0.15cm); % 4thlevelcircle
}
}
}
\end{tikzpicture}
\end{picture}
\end{figure}
\end{document}