TransWikia.com

tdplotsetrotatedcoords function is working on axes but not on drawn arcs (circle)

TeX - LaTeX Asked on March 16, 2021

According to tikz-3dplot documentation, tdplotsetrotatedcoords should rotate features following the suite of Euler angles rotations:

Description:

Generates the style tdplot_rotated_coords which provides the coordinate transformation for rotated coordinate frame within the current main coordinate frame, based on user-specified Euler angles (α,β,γ). Rotations use the z(α)y(β)z(γ) convention of Euler rotations, where the system is rotated by γ about the z-axis, then β about the (world) y-axis, and then α about the (world) z-axis.

Syntax:

tdplotsetrotatedcoords{α}{β}{γ}

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}

tdplotsetmaincoords{70}{110}
begin{tikzpicture}[tdplot_main_coords]

draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

tdplotdrawarc[green]{(O)}{.8radius}{0}{360}{}{}

tdplotsetrotatedcoords{10}{30}{70}
tdplotdrawarc[red]{(O)}{radius}{0}{360}{}{}

draw[thick,color=blue,tdplot_rotated_coords,->] (0,0,0) --(.7,0,0) node[anchor=north]{$x’$};
draw[thick,color=blue,tdplot_rotated_coords,->] (0,0,0) --(0,.7,0) node[anchor=west]{$y’$};
draw[thick,color=blue,tdplot_rotated_coords,->] (0,0,0) --(0,0,.7) node[anchor=south]{$z’$};
end{tikzpicture}

end{document}

is rendered as:

Resulting drawing

However, the red circle is always on the same xy-plane as the original unrotated green circle.

I expected it to be rotated into the x’y’-plane.

How to achieve that properly?
The tdplotsetrotatedcoords function seems not to work.

One Answer

It seems I have to enclose the circle drawing into a 'scope', but for the axes it's not the case:

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}
begin{tikzpicture}[tdplot_main_coords]
tdplotsetmaincoords{70}{110}
draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

tdplotdrawarc[green]{(O)}{.8radius}{0}{360}{}{}
tdplotsetrotatedcoords{10}{30}{70}
% Scope enclosing here:
begin{scope}[tdplot_rotated_coords]
  tdplotdrawarc[red]{(O)}{radius}{0}{360}{}{}
end{scope}

draw[thick,color=blue,tdplot_rotated_coords,->] (0,0,0) --(.7,0,0) node[anchor=north]{$x’$};
draw[thick,color=blue,tdplot_rotated_coords,->] (0,0,0) --(0,.7,0) node[anchor=west]{$y’$};
draw[thick,color=blue,tdplot_rotated_coords,->] (0,0,0) --(0,0,.7) node[anchor=south]{$z’$};
end{tikzpicture}
end{document}

Result:

result

Correct answer by s.k on March 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP