tikz 旋转 3d 箭头标记

tikz 旋转 3d 箭头标记

截屏我只是使用互联网代码示例将其拼凑在一起,但我遇到了一个问题:我希望“a”条末尾的刻度与地面平行,而不是与线垂直。 有没有可能实现这一点?

\begin{tikzpicture}[cm={-1,-1,1,0,(0,0)},x=3.85mm,z=-1cm, scale=0.5]
      \draw (2,-3,-1) coordinate (x) |- (-2,3,-1) coordinate [midway] (h) coordinate (y) -- (-2,3,1) coordinate (a) -- (-2,-3,1) coordinate (z) -- (2,-3,1) edge (x) -- (2,3,1) coordinate (v) edge (h)
      -- (a)  ;
      \draw [dashed] (-2,-3,-1) coordinate (o) edge (x) edge (y) -- (z);
      \draw [->] (0,0,0) -- (2,0,0) node [midway,above] {$x$};
      \draw [->] (0,0,0) -- (0,2,0) node [midway,right] {$y$};
      \draw [->] (0,0,0) -- (0,0,2) node [midway,above] {$z$};

      \draw [|-|] (2, 3.5, -1) -- (-2, 3.5, -1) node[midway, below right] {a};
\end{tikzpicture}

答案1

也许你必须自己画水平线,替换

\draw [|-|] (2, 3.5, -1) -- (-2, 3.5, -1) node[midway, below right] {a};

经过

\draw ( 2, 3.4,-1) -- ( 2, 3.6,-1);
\draw (-2, 3.4,-1) -- (-2, 3.6,-1);
\draw ( 2, 3.5,-1) -- node[right]{a} (-2, 3.5,-1) ;

midway请注意,您可以通过将 s 放在node行运算符之后而不是结束坐标之后来避免所有的s。

答案2

我不知道如何通过一个命令来管理它,但你可以将刻度画成单独的线:

\begin{tikzpicture}[cm={-1,-1,1,0,(0,0)},x=3.85mm,z=-1cm, scale=0.5]
      \draw (2,-3,-1) coordinate (x) |- (-2,3,-1) coordinate [midway] (h) coordinate (y) -- (-2,3,1) coordinate (a) -- (-2,-3,1) coordinate (z) -- (2,-3,1) edge (x) -- (2,3,1) coordinate (v) edge (h)
      -- (a)  ;
      \draw [dashed] (-2,-3,-1) coordinate (o) edge (x) edge (y) -- (z);
      \draw [->] (0,0,0) -- (2,0,0) node [midway,above] {$x$};
      \draw [->] (0,0,0) -- (0,2,0) node [midway,right] {$y$};
      \draw [->] (0,0,0) -- (0,0,2) node [midway,above] {$z$};

      \draw [-] (2, 3.5, -1) -- (-2, 3.5, -1) node[midway, below right] {a};
      \draw [-] (2, 3.75, -1) -- (2, 3.3, -1);
      \draw [-] (-2, 3.7, -1) -- (-2, 3.25, -1);
\end{tikzpicture}

在这种形式下,如果你想要更改坐标,那就不太方便了,因为你必须更改三条线而不是一条线的坐标。如果这是个问题,你可以使用两个节点和相对坐标,这样你只需要更改两个变量。

\begin{tikzpicture}[cm={-1,-1,1,0,(0,0)},x=3.85mm,z=-1cm, scale=0.5]
      \draw (2,-3,-1) coordinate (x) |- (-2,3,-1) coordinate [midway] (h) coordinate (y) -- (-2,3,1) coordinate (a) -- (-2,-3,1) coordinate (z) -- (2,-3,1) edge (x) -- (2,3,1) coordinate (v) edge (h)
      -- (a)  ;
      \draw [dashed] (-2,-3,-1) coordinate (o) edge (x) edge (y) -- (z);
      \draw [->] (0,0,0) -- (2,0,0) node [midway,above] {$x$};
      \draw [->] (0,0,0) -- (0,2,0) node [midway,right] {$y$};
      \draw [->] (0,0,0) -- (0,0,2) node [midway,above] {$z$};

    \node (a1) at (-2, 3.5, -1){};
    \node (a2) at (2, 3.5, -1){};
    \draw [-] (a1.center) -- (a2.center) node[midway, below right] {a};
    \draw [-] (a1.center) -- +(0,-0.25,0) -- +(0,0.2,0);
    \draw [-] (a2.center) -- +(0,-0.2,0) -- +(0,0.25,0);
\end{tikzpicture}

这两个示例看起来都应该像这样:

TikZ-样本

相关内容