如何围绕单点旋转范围环境?

如何围绕单点旋转范围环境?

我想将图形围绕单个点 B 旋转 20°。为此,我尝试使用范围环境 ( \begin{scope}[rotate around={20:(B)}] ... \end{scope}),但显然我只能让轴旋转。图形的其余部分保持静止。我在这里忘记了什么?

在此处输入图片描述

\begin{tikzpicture}[scale=0.325, decoration={
    markings,
    mark=at position 0.5 with {\arrow[line width = 2pt]{latex}}}]

    % Variables
    \def\alphaa{0.3}
    \def\R{15}
    
    \def\x{-\alphaa*\R}
    \def\xx{(1-\alphaa)*\R}
    \def\xxx{\alphaa*\R}
    \def\y{0}
    \def\yy{0}
    \def\yyy{1/2*\R}
    
    
    \def\coefx{(\yyy-\y)/(\xxx-\x)}
    \def\ordx{\R/4}
    
    \def\coefxx{(\yyy)/(\xxx)}
    \def\ordxx{0}
    
    \def\coefxxx{(\yy-\yyy)/(\xx-\xxx)}
    \def\ordxxx{\R/2*(1+\alphaa*\R/((1-2*\alphaa)*\R))}
    
    
    % Coordinates
    \coordinate (L1) at ({\R*(1-(\alphaa/3)^(1/3))},0);
    \coordinate (L2) at ({\R*(1+(\alphaa/3)^(1/3))},0);
    \coordinate (L3) at ({-\R*(1+5/12*\alphaa)},0);
    \coordinate (L4) at ({\R*(1/2*(1-2*\alphaa))},{\R*sqrt(3)/2});
    \coordinate (L5) at ({\R*1/2*(1-2*\alphaa)},{-\R*sqrt(3)/2});
    \coordinate (C1) at ({\x},{\y});
    \node[above left] at ({-\alphaa*\R-0.5},0.5) {\large $C_1$};
    \coordinate (C2) at ({\xx},{\yy});
    \node[above right] at ({(1-\alphaa)*\R+0.1},0.1) {\large $C_2$};
    \coordinate (C3) at ({\xxx},{\yyy});
    \node[above left] at (C3) {\large $P$};
    \coordinate (B) at (0,0);
    \node[above left] at (B) {\large $B$};
    
    \begin{scope}[rotate around={20:(B)}]
        % Axis
        \draw [thick, -latex, line width = 1pt, dashed] ({-\alphaa*\R-\alphaa*\R/2},0)--({\alphaa*\R/2+(1-\alphaa)*\R},0) node[below right] {\large $x$}; %x axis
        \draw [thick, -latex, line width = 1pt, dashed] (0,{-\alphaa*\R/2})--(0,{\R*1/2}) node[above left] {\large $y$}; %y axis
        
        % Celestial bodies
        \draw [thick, fill=yellow] (C1) circle (1); %C1
        \draw [thick, fill=cyan] (C2) circle (0.5); %C2
        \draw [thick, fill=gray] (C3) circle (0.25); %C3
        
        % Lengths
        \draw [thick, |<->|, line width = 1pt] ({-\alphaa*\R},{-\alphaa*\R/2})--({(1-\alphaa)*\R},{-\alphaa*\R/2}) node[midway, below] {$R=\left\|\overrightarrow{r_2}-\overrightarrow{r_1}\right\|$};
        
        \draw [thick, dashed] ({-\alphaa*\R},{-\alphaa*\R/2})--({-\alphaa*\R},0);
        \draw [thick, dashed] ({(1-\alphaa)*\R},{-\alphaa*\R/2})--({(1-\alphaa)*\R},0);
        
        
        % Vectors
        \draw [thick, postaction={decorate}, line width = 1pt] (C1)--(C3)node[midway, above left] {\large $\overrightarrow{r}-\overrightarrow{r_1}$};
        \draw [thick, postaction={decorate}, line width = 1pt] (B)--(C3)
        node[midway,below right] {\large $\overrightarrow{r_3}=\overrightarrow{r}$};
        \draw [thick, postaction={decorate}, line width = 1pt] (C2)--(C3) node[midway, above right] {\large $\overrightarrow{r}-\overrightarrow{r_2}$};
        \draw [thick, postaction={decorate}, line width = 1pt] (B)--(C1) node[midway, below] {\large $\overrightarrow{r_1}$};
        \draw [thick, postaction={decorate}, line width = 1pt] (B)--(C2) node[midway, below] {\large $\overrightarrow{r_2}$};
    \end{scope}
\end{tikzpicture}

答案1

好的,这就是对我有用的方法(即使需要进行一些调整)。您不必transform shape单独添加到每个节点,而只需在tikzpicture声明中添加(并且您不再需要scope):

围绕一个点旋转

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations,decorations.markings}

\begin{document}

    \begin{tikzpicture}[scale=.75,transform shape, rotate around={20:(0,0)}, decoration={
      markings,
      mark=at position 0.5 with {\arrow[line width = 2pt]{latex}}}]

        % Variables
        \def\alphaa{0.3}
        \def\R{15}
        
        \def\x{-\alphaa*\R}
        \def\xx{(1-\alphaa)*\R}
        \def\xxx{\alphaa*\R}
        \def\y{0}
        \def\yy{0}
        \def\yyy{1/2*\R}
        
        
        \def\coefx{(\yyy-\y)/(\xxx-\x)}
        \def\ordx{\R/4}
        
        \def\coefxx{(\yyy)/(\xxx)}
        \def\ordxx{0}
        
        \def\coefxxx{(\yy-\yyy)/(\xx-\xxx)}
        \def\ordxxx{\R/2*(1+\alphaa*\R/((1-2*\alphaa)*\R))}
        \coordinate (B) at (0,0);
        
        % Coordinates
        \coordinate (L1) at ({\R*(1-(\alphaa/3)^(1/3))},0);
        \coordinate (L2) at ({\R*(1+(\alphaa/3)^(1/3))},0);
        \coordinate (L3) at ({-\R*(1+5/12*\alphaa)},0);
        \coordinate (L4) at ({\R*(1/2*(1-2*\alphaa))},{\R*sqrt(3)/2});
        \coordinate (L5) at ({\R*1/2*(1-2*\alphaa)},{-\R*sqrt(3)/2});
        \coordinate (C1) at ({\x},{\y});
        \node[above left] at ({-\alphaa*\R-0.5},0.5) {\large $C_1$};
        \coordinate (C2) at ({\xx},{\yy});
        \node[above right] at ({(1-\alphaa)*\R+0.1},0.1) {\large $C_2$};
        \coordinate (C3) at ({\xxx},{\yyy});
        \node[above left] at (C3) {\large $P$};
        
        \node[above left] at (B) {\large $B$};
    
    
        % Axis
        \draw [thick, -latex, line width = 1pt, dashed] ({-\alphaa*\R-\alphaa*\R/2},0)--({\alphaa*\R/2+(1-\alphaa)*\R},0) node[below right] {\large $x$}; %x axis
        \draw [thick, -latex, line width = 1pt, dashed] (0,{-\alphaa*\R/2})--(0,{\R*1/2}) node[above left] {\large $y$}; %y axis
        
        % Celestial bodies
        \draw [thick, fill=yellow] (C1) circle (1); %C1
        \draw [thick, fill=cyan] (C2) circle (0.5); %C2
        \draw [thick, fill=gray] (C3) circle (0.25); %C3
        
        % Lengths
        \draw [thick, |<->|, line width = 1pt] ({-\alphaa*\R},{-\alphaa*\R/2})--({(1-\alphaa)*\R},{-\alphaa*\R/2}) node[midway, below] {$R=\left\|\overrightarrow{r_2}-\overrightarrow{r_1}\right\|$};
        
        \draw [thick, dashed] ({-\alphaa*\R},{-\alphaa*\R/2})--({-\alphaa*\R},0);
        \draw [thick, dashed] ({(1-\alphaa)*\R},{-\alphaa*\R/2})--({(1-\alphaa)*\R},0);
        
        
        % Vectors
        \draw [thick, postaction={decorate}, line width = 1pt] (C1)--(C3)node[midway, above left] {\large $\overrightarrow{r}-\overrightarrow{r_1}$};
        \draw [thick, postaction={decorate}, line width = 1pt] (B)--(C3)
        node[midway,below right] {\large $\overrightarrow{r_3}=\overrightarrow{r}$};
        \draw [thick, postaction={decorate}, line width = 1pt] (C2)--(C3) node[midway, above right] {\large $\overrightarrow{r}-\overrightarrow{r_2}$};
        \draw [thick, postaction={decorate}, line width = 1pt] (B)--(C1) node[midway, below] {\large $\overrightarrow{r_1}$};
        \draw [thick, postaction={decorate}, line width = 1pt] (B)--(C2) node[midway, below] {\large $\overrightarrow{r_2}$};

    \end{tikzpicture}

\end{document}

是的,如果你将缩放系数保持在这么低的水平,文本就会变得非常小。所以我觉得最好将缩放系数调小一点。你也可以调整文本大小和圆圈大小等一些内容。

相关内容