气缸旋转

气缸旋转

我有以下 tikzpicture,

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric}


\begin{document}
\begin{tikzpicture}
\draw[dashed](-3,-3)--(3,3);
\draw[dashed](-3,3)--(3,-3);
\draw(0,0)--(3,0);
\node[cylinder,fill=gray, shape border rotate=180,shift={(2cm,0cm)}, draw, minimum height=0.1cm, minimum width=0.1cm] {};
\node at(1,0.2){\small $r$};
\draw plot[smooth,tension=1]coordinates{(0.3,-0.3)(0.4,-0.15)(0.35,0)};
\node at(0.6,-0.2){\small $\phi$};
\draw[-latex](1.75,0.3)--(2.2,0.3);
\node at(1.975,0.5){\small $v$};
\draw[-latex] plot[smooth,tension=1]coordinates{(3,-0.2)(3.1,0)(3,0.2)};
\node at (3.4,0){\small $\omega$};
\draw(1.5,0)--(1.75,0);
\end{tikzpicture}

\end{document}

在此处输入图片描述

然后,我想旋转这个形状但是发生了一些不寻常的事情。

\begin{tikzpicture} 
\begin{scope}[shift = {(1,1)}, rotate = 45]
\draw[dashed](-3,-3)--(3,3);
\draw[dashed](-3,3)--(3,-3);
\draw(0,0)--(3,0);
\node[cylinder,fill=gray, shape border rotate=180,shift={(2cm,0cm)}, draw, minimum height=0.1cm, minimum width=0.1cm] {};
\node at(1,0.2){\small $r$};
\draw plot[smooth,tension=1]coordinates{(0.3,-0.3)(0.4,-0.15)(0.35,0)};
\node at(0.6,-0.2){\small $\phi$};
\draw[-latex](1.75,0.3)--(2.2,0.3);
\node at(1.975,0.5){\small $v$};
\draw[-latex] plot[smooth,tension=1]coordinates{(3,-0.2)(3.1,0)(3,0.2)};
\node at (3.4,0){\small $\omega$};
\draw(1.5,0)--(1.75,0);
\end{scope}
\end{tikzpicture}

气缸保持在同一位置。我该如何解决这个问题? 在此处输入图片描述

答案1

这是我尝试使用transform canvas ={rotate=45}而不是rotate=45

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}


\begin{tikzpicture} 

\path (-5,-5) rectangle (5,5);
\begin{scope}[transform canvas ={rotate=45}]
  \draw[dashed](-3,-3)--(3,3);
  \draw[dashed](-3,3)--(3,-3);
  \draw(0,0)--(3,0);
  \node[cylinder,fill=gray, shape border rotate=180,shift={(2cm,0cm)}, draw, minimum height=0.1cm, minimum width=0.1cm] {};
  \node at(1,0.2){\small $r$};
  \draw plot[smooth,tension=1]coordinates{(0.3,-0.3)(0.4,-0.15)(0.35,0)};
  \node at(0.6,-0.2){\small $\phi$};
  \draw[-latex](1.75,0.3)--(2.2,0.3);
  \node at(1.975,0.5){\small $v$};
  \draw[-latex] plot[smooth,tension=1]coordinates{(3,-0.2)(3.1,0)(3,0.2)};
  \node at (3.4,0){\small $\omega$};
  \draw(1.5,0)--(1.75,0);
\end{scope}
\end{tikzpicture}

\end{document}

得出的结果是:

在此处输入图片描述

相关内容