1

Goal

Using tikz-3dplot, I would like to draw the great circle that delineates what would be the outline of the sphere of radius 1 as seen from the fixed viewpoint (in other words, the plane perpendicular to the vector describing the view direction) in order to avoid other great circles to give the impression that they "go out" of that sphere (purple outlines in the figure below, so which doesn't show any overlap with every of the other great circles).

MWE

\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}

Result of the current code:

Resulting drawing

What I would like is to get the result of the composition of the first, then the second rotation (in that order) in the Testing part but I don't know how to tell that to tikz.

1 Answer 1

0

Adding this to the tikzpicture solved the described problem:

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

Here is a the resulting circle (in red) for a polar angle of 55 degrees instead of 75 for a better visual effect:

result_55

The magical appears by using the \tdplotsetrotatedcoords function:

tdplotsetrotatedcoords function definition

Source: The tikz-3dplot Package by Jeff Hein, January 24, 2010

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.