# tikz - Tangential rectangles on circular path

I would like to place rectangles on a circular path, in a way that they are tangential to the circle.

If I use polar coordinates and connected lines, I end up with something like this:

I want the rectangular sections to stay truly rectangular. If I use the rectangle command together with the rotate option, I have troubles placing the rectangles along a circular path.

Is it possible to use the rectangle command with polar coordinates?

Edit: My poor attempt was the following:

\documentclass[a4paper,10pt]{scrreprt}
\usepackage{tikz}
\begin{tikzpicture}[scale=1]
\foreach \a in {0, 45, 90, 135, 180}{
\path[draw] (\a:1) -- (\a:2) -- (\a + 10:2) -- (\a + 10:1) -- cycle;
}
\end{document}

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – LaRiFaRi Sep 7 '15 at 9:56

\documentclass[tikz, border=2mm]{standalone}

\begin{document}

\begin{tikzpicture}

\draw circle (3cm);

\draw (30:3cm) node[draw, anchor=south, rotate=-60, minimum width=1cm] {A};

\draw (60:3cm) node[draw, anchor=south, rotate=-30, minimum width=1cm] {B};

\draw (215:3cm) node[draw, anchor=south, rotate=125, minimum width=1cm] {C};
\end{tikzpicture}

\end{document}


• I did not know about minimum width/minimum height parameters, which apparently lets you create arbitrary rectangles. :D – circularpath2 Sep 7 '15 at 10:13

I think this does it:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{math}
\begin{document}
\begin{tikzpicture}
\tikzmath{%
\r = 1;
\a = 10; % angle of chord forming base of rectangle
\s = 15; % angle between rectangle centers
\R = \r * cos(\s / 2);
\n = int(360 / \s);
\x = \r / 2 * sin(\a);
}

\foreach \i in {1, ..., \n}
\draw [help lines]
(0,0) -- (\i*\s-\a/2:\r+1/2) (0,0) -- (\i*\s+\a/2:\r+1/2);

\foreach \i in {1, ..., \n}
\draw [shift=(\i*\s:\R),rotate=\i*\s+270]
(-\x, 0) rectangle (\x, 1/8);
\end{tikzpicture}
\end{document}


You can use a \foreach loop to draw rectangles around a circle.

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[
rectangle node/.style={
minimum width = \w,
minimum height = \h,
fill = gray,
inner sep = 0pt,
anchor = center,
},
]
% Variables
\def\N{36}% Number of rectangles - 1
\def\h{0.2cm}% height of rectangles
\def\w{0.4cm}% width of rectangles

I defined some variables to set the size of the rectangles (\w and \h), the number of rectangles (\N+1) and the radius of the circle (\R).