tikz中兩個旋轉的組成

tikz中兩個旋轉的組成

目標

使用tikz-3dplot,我想畫出大圓它描繪了從固定視點(換句話說,垂直於描述視圖方向的向量的平面)看到的半徑為 1 的球體的輪廓,以避免其他大圓給人留下「它們在移動」的印象。球體(下圖中的紫色輪廓,因此與其他大圓沒有任何重疊)。

微量元素

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage[english]{babel}
\usepackage{float}
\usepackage{tikz}
\usepackage{tikz-3dplot}
%%%%%%%%
\begin{document}
\pgfmathsetmacro{\rvec}{1}
\pgfmathsetmacro{\thetavec}{54}
\pgfmathsetmacro{\phivec}{54}
\pgfmathsetmacro{\view}{135}

\tdplotsetmaincoords{75}{\view}

\definecolor{darkgreen}{rgb}{0.1,0.9,0.1}

\begin{tikzpicture}[scale=5,tdplot_main_coords]
\coordinate (O) at (0,0,0);
% Axes
\draw[thick,->] (O) -- (2.0,0,0) node[anchor=north east]{$X$};
\draw[thick,->] (O) -- (0,2.0,0) node[anchor=north west]{$Y$};
\draw[thick,->] (O) -- (0,0,1.4) node[anchor=south]{$Z$};

% Great circle in the OXZ plane
\tdplotsetthetaplanecoords{0}
\tdplotdrawarc[tdplot_rotated_coords]{(O)}{\rvec}{0}{180}{}{}
\tdplotdrawarc[tdplot_rotated_coords,loosely dashed,gray]{(O)}{\rvec}
{180}{360}{}{}

% Great circle in the OYZ plane
\tdplotsetthetaplanecoords{90}
\tdplotdrawarc[tdplot_rotated_coords]{(O)}{\rvec}{0}{180}{}{}
\tdplotdrawarc[tdplot_rotated_coords,losely dashed,gray]{(O)}{\rvec}
{180}{360}{}{}

% Great circle in the OXY plane
\tdplotdrawarc[blue]{(O)}{\rvec}{-55}{125}{}{}
\tdplotdrawarc[loosely dashed,blue]{(O)}{\rvec}{125}{305}{}{}

%% Testing great circles
% Rotated Great circle around Z-axis, this is the first wanted rotation
% to bring it in the original, non rotated "O-Y_ori-Z" plane.
\tdplotsetthetaplanecoords{\view}
\tdplotdrawarc[tdplot_rotated_coords,cyan]{(O)}{\rvec}{0}{360}{}{}

% Rotated big circle around Y-axis, this second rotation should be applied
% just after the previous one, i.e. on the great circle colored in cyan.
% How to do that ?
\tdplotsetrotatedthetaplanecoords{15}
\tdplotdrawarc[tdplot_rotated_coords,darkgreen]{(O)}{\rvec}{0}{360}{}{}

\end{tikzpicture}
\end{document}

目前程式碼的結果:

結果圖

我想要的是獲得該部分中第一個、然後第二個旋轉(按順序)的組合結果Testing,但我不知道如何將其告訴 tikz。

答案1

將其添加到tikzpicture已解決的所描述的問題中:

\tdplotsetrotatedcoords{\azimuth-90}{75}{0}
\begin{scope}[tdplot_rotated_coords]
  \tdplotdrawarc[red]{(O)}{\radius}{0}{360}{}{}
\end{scope}

下面是極角為 55 度(而不是 75 度)時產生的圓圈(紅色),以獲得更好的視覺效果:

結果_55

透過使用以下函數,魔法就會出現\tdplotsetrotatedcoords

tdplotsetrotatedcoords 函數定義

來源:tikz-3dplot 包,作者:Jeff Hein,2010 年 1 月 24 日

相關內容