控制Tikz图片中旋转一定角度的文本

控制Tikz图片中旋转一定角度的文本

我正在制作一张小图来解释汽车上坡的能力。我无法控制每个箭头旁边的标签。我想让它们垂直或平行,但它们不会随着图片转动。

\documentclass[border=0.2cm]{standalone}

\usepackage{tikz}
\usetikzlibrary{arrows, arrows.meta}

\begin{document}

\newcommand{\ang}{30}

\begin{tikzpicture} [font = \small]

% triangle:
\draw [draw = orange, fill = orange!15] (0,0) coordinate (O) -- (\ang:10)
    coordinate [pos=.35] (M) |- coordinate (B) (O);

% angles:
\draw [draw = orange] (O) ++(.8,0) arc (0:\ang:0.8) 
    node [pos=.4, left] {$\theta$};
\draw [draw = orange] (B) rectangle ++(-0.3,0.3);

\begin{scope} [-latex,rotate=\ang]

% Object (rectangle)
\draw [fill = purple!30,
    draw = purple!50] (M) ++ (0,0.2) rectangle ++ (4,1.5);
    
% Object (wheel1)
\draw [fill=lightgray] (M) ++ (0.3,0.2) coordinate (w1)  circle (.2cm);
% Object (wheel2)
\draw [fill=lightgray] (M) ++ (3.5,0.2) coordinate (w2)  circle (.2cm);

% Weight and its projections
\draw [dashed] (M) ++ (2,.9) coordinate (MM) -- ++ (0,-1.29)
    node [midway,  right] {$mg\cos{\theta}$};

\draw [dashed] (MM) -- ++ (-0.75,0) 
    node [very near end, left] {$mg\sin{\theta}$};

\draw (MM) -- ++ (-\ang-90:1.5)
    node [very near end,below left ] {$mg$};

% Normal Force 2
\draw (M) ++ (0.3,-1.1) coordinate (N2) -- ++ (0,1.1)
node [very near start, left] {$N_2$};
% Normal Force 1
\draw (M) ++ (3.5,-1.1) coordinate (N1) -- ++ (0,1.1)
node [very near start, right] {$N_1$};

% Speed
\draw (M) ++ (1.5,2.2) coordinate (w2) -- ++ (0.75,0)
    node [above] {$v$};

% Traction force
\draw (M) ++ (-0.8,0) coordinate (TF) -- ++ (1,0)
    node [very near start, above] {$F_t$};
    
\end{scope}

\begin{scope} [rotate=\ang]

\draw  [blue] (MM) --  ++ (2.7,0)   node [very near end, left] {$ $};
    
\draw [blue,>=triangle 45, <->] (8,0.9) --  (8,0) node [midway, right] {$h$};;

\draw [blue,>=triangle 45, <->] (3.8,-0.9) --  (5.5,-0.9) node [midway, above] {$b$};;
\draw [blue,>=triangle 45, <->] (MM)++ (0,-1.8) --  (7,-0.9) node [midway, above] {$a$};;

\end{scope}


\end{tikzpicture} 
\end{document}

图像:

在此处输入图片描述

相关内容