重复绘制等腰三角形

重复绘制等腰三角形

从答案到这个问题,我想添加重复的圆形、矩形和等腰三角形。我使用此代码绘制了下图,但我无法使用它\foreach来重复绘制等腰三角形

\documentclass{beamer}
\usetheme{PaloAlto}
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}
\usetikzlibrary{arrows, arrows.meta, positioning, calc, intersections, decorations.pathreplacing, decorations.pathmorphing, decorations.markings, decorations.fractals, decorations.footprints, shapes, shapes.misc, shapes.symbols, shapes.geometric, patterns, backgrounds, shadows}
\usetikzlibrary{fadings, shadings}%for snake
%
% begin to set all frametitles to bold
\setbeamerfont{frametitle}{series=\bfseries}
% end to set all frametitles to bold
%
 \definecolor{darkteal2}{rgb}{0.,0.9,0.8}
\definecolor{darkgreen1}{rgb}{0.,0.55,0.1}

%begin definition xraytube and headtop   % in headtop apply horizontal flip of ear to compare angles
\def\scl{.4}
\def\wda{1}%1.2
\def\wdb{2}
\def\wdc{4}

\def\xraytube
{%
\begin{scope}[scale=\scl, opacity=1, line width=.05cm, rounded corners=5pt, transform shape,overlay]
\draw[gray, bottom color=gray, top color=gray!25](-\wda,0) --++(-90:\wdc) --++(180:\wdb) --++(-90:\wdb) --++(0:\wdb) --++(0:\wda) --++(0:\wda)--++(0:\wdb)  --++(90:\wdb) --++(180:\wdb) --++(90:\wdc) -- cycle;
\draw[gray, top color=gray, bottom color=gray!40](0,-.25) ellipse (1. and 0.5);
\end{scope}
}%

\def\headtop
{%
\begin{scope}[scale=2*\scl, line width=.05cm, rounded corners=3pt, rotate=0, looseness=1.,overlay]
\node (o) at (0,0) {};
\node (or) at ([shift={(0.:4.)}]o.center) {};
\node (ot) at ([shift={(86.:1.)}]o.center) {};
\node (ort) at ([shift={(95.:1.)}]or.center) {};
\node (x) at ([shift={(56.5:3.6)}]o.center) {};
\node (xt) at ([shift={(90:.3)}]x.center) {};
\node (xl) at ([shift={(180:.34)}]x.center) {};
\node (xr) at ([shift={(0:.34)}]x.center) {};

\draw[brown, bottom color=brown!60!orange!25!white, top color=brown!60] (xl.center) to [out=40, in=-140] (xt.center) to [out=-40, in=140] (xr.center);

\draw[brown, right color=brown!60!orange!25!white, left color=brown!60] (o.center) to [out=-170, in=160] (ot.center);

\draw[brown, left color=brown!60!orange!25!white, right color=brown!60] (or.center) to [out=-10, in=20] (ort.center);

\draw[brown, inner color=brown!60!orange!25!white, outer color=brown!60] (o.center) arc (180:360:2) to[out=90,in=0] (x.center) to[out=180,in=90] (o.center) -- cycle;
\end{scope}
}%
%end definition xraytube and headtop
\def\trngl
{%
\begin{scope}[scale=2*\scl, line width=.05cm, rotate=0]
\draw[green!70!black,fill=green!70!black]  (90:.55) -- (210:.55) -- (330:.55) -- cycle;
\end{scope}
}%

\begin{document}
% begin frame
\begin{frame}[t]
 \frametitle {xray tube headtop}

\vspace {-.4cm}
\begin{tikzpicture}[scale=1]
\hskip 5.4cm
\draw[gray, top color=gray, bottom color=gray, middle color=gray!40] (0,0) rectangle +(5,-.2) node[midway]{.};
\end{tikzpicture}

\begin{tikzpicture}[scale=0.8]
\begin{scope}[yshift=-6.5cm, xshift=9.86cm]
\xraytube
\end{scope}

\begin{scope}[yshift=-4.2cm, xshift=8.28cm]
\headtop
\end{scope}
\end{tikzpicture}

\vspace {-.56cm}

\begin{tikzpicture}[decoration={snake, amplitude=.4mm, segment length=3mm, post length=4mm}]
\hskip 7.83cm
\draw<2->[decorate, darkteal2, -latex, line width=.05cm] (0,0) -- ++(90:5.8cm);
\end{tikzpicture}

\vspace {-3.1cm}

\begin{tikzpicture}[scale=.4, transform shape]
\hskip 6cm
\begin{scope}[yshift=0cm, xshift=0cm]
\draw<2->[line width=.06cm, red, dashed] (0,0)--++(0:8cm);
\foreach \x in {2,4,6} \draw<2->[line width=.06cm, red, fill=red] (\x,0) circle (.25cm);
\end{scope}

\begin{scope}[yshift=2cm, xshift=-.25cm]
\draw<2->[line width=.06cm, blue, dashed] (.25,0)--++(0:8cm);
\foreach \x in {2,4,6} \draw<2->[line width=.06cm, blue, fill=blue] (\x,-0.25) rectangle ++(0.5,0.5);
\end{scope}

\begin{scope}[yshift=4cm, xshift=-.25cm]
\draw<2->[line width=.06cm, green!60!black, dashed] (.25,0)--++(0:8cm);
\hskip .92cm<2-> \trngl
\hskip .8cm<2-> \trngl
\hskip .8cm<2-> \trngl
\end{scope}
\end{tikzpicture}
\end{frame} 
% end frame
\end{document}

在此处输入图片描述

在此处输入图片描述

答案1

我想出了下面的代码来绘制三角形

\begin{scope}[yshift=4cm, xshift=-.25cm]
\draw[line width=.06cm, green!60!black, dashed] (.25,0)--++(0:8cm);
\foreach \x in {2,4,6} \draw[line width=.06cm, green!70!black, fill=green!70!black] (\x,0) --++ (60:.6) --+ (-60:.6)-- cycle;
\end{scope}

1

相关内容