tikz 3dplot에서 큐브의 회전 방향을 표시하는 방법

tikz 3dplot에서 큐브의 회전 방향을 표시하는 방법

나는 양쪽 끝에 머리가 있는 반원형 화살표를 시도합니다. 모두 O 주위에 중심이 있어야 합니다. 그려진 큐브의 회전 방향을 표시해야 합니다. 예를 들어 하나의 반원형 화살표는 S1에서 시작하여 S2를 터치하고 S3에서 끝납니다. 따라서 총 6개의 화살이 있어야 합니다.

나는 지금 2시간 동안 시도해 보았지만 "arc"의 기능을 얻지 못했습니다. 내가 얻는 건여기에 이미지 설명을 입력하세요

내가 원하는 곳으로 가는 방법에 대한 힌트나 해결책을 제공해 줄 수 있는 사람이 있나요?

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{adjustbox}
\usetikzlibrary{calc}

\begin{document}
\trimbox{6.8cm 0cm 0cm 0cm}{
\tdplotsetmaincoords{0}{0}
\tdplotsetrotatedcoords{60}{70}{35}%
\begin{tikzpicture}
    [tdplot_rotated_coords,
        cube/.style={black},
        arr/.style={-latex,color=green!70,thick,line cap=round,shorten <= 1.5pt}]

\coordinate (A1) at (0,0,0);
\coordinate (A2) at (0,1,0);
\coordinate (A3) at (1,1,0);
\coordinate (A4) at (1,0,0);
\coordinate (B1) at (0,0,1);
\coordinate (B2) at (0,1,1);
\coordinate (B3) at (1,1,1);
\coordinate (B4) at (1,0,1);
\coordinate (O) at ($(A1)!0.5!(B3)$);
\coordinate (S1) at ($(A1)!0.5!(B2)$);
\coordinate (S2) at ($(B2)!0.5!(A3)$);
\coordinate (S3) at ($(A3)!0.5!(B4)$);
\coordinate (S4) at ($(B4)!0.5!(A1)$);
\coordinate (S5) at ($(B1)!0.5!(B3)$);
\coordinate (S6) at ($(A1)!0.5!(A3)$);

\draw[cube] (B1) -- (B2) -- (B3) -- (B4) -- cycle;
\draw[cube] (A2) -- (B2);
\draw[cube] (A3) -- (B3);


\begin{scope}[canvas is zy plane at x=0]
\draw[arr] (0:0.5) arc (90:0:-0.5) ;
\draw[arr] (0:0.5) arc (-180:0:-0.5) ;
\end{scope}

\begin{scope}[canvas is zx plane at y=0]
\draw[arr] (0:0.5) arc (180:0:-0.5) ;
\draw[arr] (0:0.5) arc (-180:0:-0.5) ;
\end{scope}

\begin{scope}[canvas is yx plane at z=0]
\draw[arr] (0:0.5) arc (180:0:-0.5) ;
\draw[arr] (0:0.5) arc (-180:0:-0.5) ;
\end{scope}

\draw[cube] (A1) -- (A2) -- (A3) -- (A4) -- cycle;
\draw[cube] (A1) -- (B1);
\draw[cube] (A4) -- (B4);

\end{tikzpicture}}

\end{document}

답변1

(O) +John Kormylo의 조언을 듣고 시작 좌표로 ...을 사용하고 첫 번째 호가 90도 대신 180도에서 시작하도록 수정하면 원래 코드는 실제로 요청한 것과 매우 가깝습니다.

불행하게도 결과 다이어그램은 매우 복잡하며 3D에서 호를 적절하게 해석하는 것이 매우 어렵습니다(제 생각에는). 도움이 될 수 있는 한 가지는 이중선을 사용하여 일부 선이 다른 선보다 "앞에" 있다는 생각을 강화하는 것입니다. 또한 화살촉이 좀 덜 어색해 보이도록 라이브러리를 추가하고 bending화살촉이 모두 같은 위치를 가리키지 않도록 해당 원을 따라 배치했습니다.

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{adjustbox}
\usetikzlibrary{calc, arrows.meta}
\usetikzlibrary{bending}

\begin{document}
\trimbox{6.8cm 0cm 0cm 0cm}{
\tdplotsetmaincoords{0}{0}
\tdplotsetrotatedcoords{60}{70}{35}%
\begin{tikzpicture}[
      tdplot_rotated_coords,
      cube/.style={white, double=black, double distance=.1mm, join=bevel},
      arr/.style={-{latex[color=green!70]},
        white, double=green!70, shorten <= 1pt, shorten >=1pt
      }
    ]

\coordinate (A1) at (0,0,0);
\coordinate (A2) at (0,1,0);
\coordinate (A3) at (1,1,0);
\coordinate (A4) at (1,0,0);
\coordinate (B1) at (0,0,1);
\coordinate (B2) at (0,1,1);
\coordinate (B3) at (1,1,1);
\coordinate (B4) at (1,0,1);
\coordinate (O) at ($(A1)!0.5!(B3)$);
\draw[cube] (B1) -- (B2) -- (B3) -- (B4) -- cycle
  (A2) -- (B2)
  (A3) -- (B3);

% These must be drawn back to front
\draw[arr, canvas is zx plane at y=0] (O) +(0:0.5) arc (0:-180:0.5);
\draw[arr, canvas is yz plane at x=0] (O) +(0:0.5) arc (0:180:0.5);
\draw[arr, canvas is xy plane at z=0] (O) +(180:0.5) arc (180:0:0.5);
\draw[arr, canvas is xy plane at z=0] (O) +(180:0.5) arc (-180:0:0.5);
\draw[arr, canvas is yz plane at x=0] (O) +(0:0.5) arc (0:-180:0.5);
\draw[arr, canvas is zx plane at y=0] (O) +(0:0.5) arc (0:180:0.5);

\draw[cube] (A1) -- (A2) -- (A3) -- (A4) -- cycle
  (A1) -- (B1)
  (A4) -- (B4);

\end{tikzpicture}
}

\end{document}

회전 큐브

답변2

arr양방향 화살표로 재정의 하고 에 점을 추가했습니다 (O).

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{adjustbox}
\usetikzlibrary{calc}

\begin{document}
\trimbox{6.8cm 0cm 0cm 0cm}{
\tdplotsetmaincoords{0}{0}
\tdplotsetrotatedcoords{60}{70}{35}%
\begin{tikzpicture}
    [tdplot_rotated_coords,
        cube/.style={black},
        arr/.style={latex-latex,color=green!70,thick}]

\coordinate (A1) at (0,0,0);
\coordinate (A2) at (0,1,0);
\coordinate (A3) at (1,1,0);
\coordinate (A4) at (1,0,0);
\coordinate (B1) at (0,0,1);
\coordinate (B2) at (0,1,1);
\coordinate (B3) at (1,1,1);
\coordinate (B4) at (1,0,1);
\coordinate (O) at ($(A1)!0.5!(B3)$);
\coordinate (S1) at ($(A1)!0.5!(B2)$);
\coordinate (S2) at ($(B2)!0.5!(A3)$);
\coordinate (S3) at ($(A3)!0.5!(B4)$);
\coordinate (S4) at ($(B4)!0.5!(A1)$);
\coordinate (S5) at ($(B1)!0.5!(B3)$);
\coordinate (S6) at ($(A1)!0.5!(A3)$);

\draw[cube] (B1) -- (B2) -- (B3) -- (B4) -- cycle;
\draw[cube] (A2) -- (B2);
\draw[cube] (A3) -- (B3);

\fill (O) circle[radius=1pt];

\begin{scope}[canvas is zy plane at x=0]
\draw[arr] (O) +(90:0.5) arc (90:-90:0.5) ;
\end{scope}

\begin{scope}[canvas is zx plane at y=0]
\draw[arr] (O) +(90:0.5) arc (90:-90:0.5) ;
\end{scope}

\begin{scope}[canvas is yx plane at z=0]
\draw[arr] (O) +(90:0.5) arc (90:-90:0.5) ;
\end{scope}

\draw[cube] (A1) -- (A2) -- (A3) -- (A4) -- cycle;
\draw[cube] (A1) -- (B1);
\draw[cube] (A4) -- (B4);

\end{tikzpicture}}

\end{document}

데모

관련 정보