![我该如何绘制这个钟摆,使钟摆向右移动而不是向左移动?](https://linux22.com/image/459514/%E6%88%91%E8%AF%A5%E5%A6%82%E4%BD%95%E7%BB%98%E5%88%B6%E8%BF%99%E4%B8%AA%E9%92%9F%E6%91%86%EF%BC%8C%E4%BD%BF%E9%92%9F%E6%91%86%E5%90%91%E5%8F%B3%E7%A7%BB%E5%8A%A8%E8%80%8C%E4%B8%8D%E6%98%AF%E5%90%91%E5%B7%A6%E7%A7%BB%E5%8A%A8%EF%BC%9F.png)
答案1
欢迎来到 TSE。
这是使用 tikz 的解决方案。您可以轻松更改第一个参数。代码中添加了注释。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, positioning}
\begin{document}
\begin{tikzpicture}[>=latex']
\pgfmathsetmacro\nHoles{9} % defines the number of holes
\pgfmathsetmacro\dHoles{-1.5} % defines the distance between holes
\pgfmathsetmacro\pivot{2} % number of the pivot (starting from 1)
\pgfmathsetmacro\angle{30} % angle of the rotation
\pgfmathsetmacro\barOffset{10} % offset between holes and bar edges
\def\lPos{right} % position of the labels L and l
\pgfmathsetmacro\signL{sign(sin(\angle))} % to determine on which side putting the arrows
\begin{scope}[rotate around={\angle:(0,\pivot*\dHoles cm)}] % a scope to rotate the bar
\foreach \H in {1,...,\nHoles} % a loop to draw the holes
{\draw (0, \H*\dHoles cm) circle [radius=4pt] node (H_\H) {};}
\draw [very thick, red] (0, \pivot*\dHoles cm) circle [radius=4pt] node (P) {}; % redraw the pivot and name it P
\draw ($(H_1.center)+(\barOffset pt, \barOffset pt)$) rectangle ($(H_\nHoles.center)-(\barOffset pt, \barOffset pt)$); % draw the bar
\draw [thin, dotted] ($(H_1)+(0, \barOffset pt)$) --++ (\signL*2 cm, 0);
\draw [thin, dotted] ($(H_\nHoles)-(0, \barOffset pt)$) --++ (\signL*2cm, 0);
\draw [<->] ($(H_1)+(\signL*2 cm, \barOffset pt)$) -- ($(H_\nHoles)+(\signL*2 cm, -\barOffset pt)$) node [ \lPos=3pt, pos=.5] {$L$}; % label L
\fill ($(H_1)!.5!(H_\nHoles)$) circle [radius=2pt] coordinate (CM); % define the center
\draw [thin, dotted] (P.center) --++ (\signL*1cm, 0);
\draw [thin, dotted] (CM.center) --++ (\signL*1cm, 0);
\draw [<->] ($(P.center)+(\signL*1 cm, 0)$) -- ($(CM)+(\signL*1 cm, 0)$) node [ \lPos=3pt, pos=.5] {$\ell$}; % label l
\end{scope} % end of the rotated part
\node at ($(CM)+(\signL*2*\barOffset pt, 0)$) {$CM$}; % add the CM label
\draw [dashed] (0,\dHoles) -- (0, \nHoles*\dHoles); % vertical line
\draw [->] ($(P)+(0, 1.5*\dHoles)$) arc [start angle=90,end angle=90+\angle, radius=1.5*\dHoles cm] node [anchor=north, pos=.5] {$\theta$}; % angle
\end{tikzpicture}
\end{document}
由此产生了下面的图片。