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 函数定义

来源:Jeff Hein 于 2010 年 1 月 24 日发布的 tikz-3dplot 软件包

相关内容