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?

2
  • Does this topic help?
    – masu
    Oct 15, 2013 at 12:10
  • Not, that doesn't solve my problem.
    – Mokus
    Oct 15, 2013 at 12:35

1 Answer 1

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}
3
  • Thanks for your help, I have one more question, how can I create a node from the \windturbine?
    – Mokus
    Oct 15, 2013 at 15:37
  • Check this topic.
    – masu
    Oct 15, 2013 at 15:45
  • @run did it help?
    – masu
    Oct 16, 2013 at 13:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .