3

I have a custom command

\newcommand\windturbine[2][]{
  \begin{scope}[shift={(#2)}]
    \draw[#1] (0,0) ellipse (0.7cm and 0.1cm);
    \draw[#1] (0.8,0) circle (0.1cm );
    \draw[#1] (1.6,0) ellipse (0.7cm and 0.1cm);
  \end{scope}
}

Lets draw two wind turbine

\begin{tikzpicture}

  \windturbine[draw=black,fill=black, very thick]{0,0};  
  \windturbine[draw=black,fill=black, very thick]{0,7};

\end{tikzpicture}

I would like to rotate the first one with x degree and connect the two drawings with a line, how can I achieve that?

Mokus
  • 633
  • 1
  • 5
  • 14

1 Answers1

3

I couldn't find out which one is the "first" (the first you wrote, or the first on the page). Why don't you use the rotate option?

If you set the middle of the coordinates in the middle of the turbine (rewrite the \windturbine command like this), you can easily connect them with a line (using their coordinates).

\documentclass{minimal}

\usepackage{tikz}

\newcommand\windturbine[2][]{
  \begin{scope}[shift={(#2)}]
    \draw[#1] (-0.8,0) ellipse (0.7cm and 0.1cm);
    \draw[#1] (0,0) circle (0.1cm );
    \draw[#1] (0.8,0) ellipse (0.7cm and 0.1cm);
  \end{scope}
}

\begin{document}

\begin{tikzpicture}[scale=2]

  \windturbine[draw=black,fill=black, very thick]{0,0};  
  \windturbine[draw=black,fill=black, very thick, rotate=30]{0,7};
    \draw[very thick] (0,0) -- (0,7);

\end{tikzpicture}

\end{document}
Torbjørn T.
  • 206,688
masu
  • 6,571