TransWikia.com

Tikz: 3D cylindrical coordinates diagram - angle phi

TeX - LaTeX Asked on April 26, 2021

I’m trying to draw the following diagram with Tikz but I struggle with drawing the angle phi.

goal diagram

As you can see below there’s a problem with the angle. :

documentclass[tikz,border=10pt]{standalone}
usetikzlibrary{calc,patterns}
begin{document}

begin{center}
  begin{tikzpicture}
    coordinate (origo) at (0,0);
    coordinate (pivot) at (1,-1);
    coordinate (point) at (1,2);

    draw [->] (origo) -- (-2,-2) node (x) [below] {$x$};
    draw [->] (origo) -- (3,0) node [right] {$y$};
    draw [->] (origo) -- (0,3) node [above] {$z$};

    draw [dashed,-] (origo) -- (pivot) node (r) [pos = 0.5, anchor = south west] {$r$};
    draw [dashed,-] (pivot) -- (point) node [pos = 0.6, anchor = west] {$z$} node [circ] {} node [thick,above] {$P$};

    pic [draw, ->, "$theta$", angle eccentricity=1.5] {angle = x--origo--r};
  end{tikzpicture}
end{center}

end{document}

result

current result

One Answer

Like this? A bit different from your code.

documentclass[margin=3mm]{standalone}
usepackage{tikz,tikz-3dplot}
usetikzlibrary{arrows,chains,shapes.geometric,shapes,angles,quotes}
begin{document}
tdplotsetmaincoords{60}{115}
begin{tikzpicture}
    [scale=0.9,
    tdplot_main_coords,
    axis/.style={-latex,thick,color=gray},
    vector/.style={-stealth,red,very thick},
    vector guide/.style={dashed,thick,color=cyan}]

%standard tikz coordinate definition using x, y, z coords
% A(2,4,3), B(3,-1,4)
defAx{1.5}
defAy{1.5}
defAz{2.5}
coordinate (O) at (0,0,0);
coordinate (A) at (Ax,Ay,Az);
%draw axes
draw[axis] (0,0,0) -- (3,0,0)coordinate(X) node[anchor=north east]{$x$};
draw[axis] (0,0,0) -- (0,2.5,0) node[anchor=north west]{$y$};
draw[axis,color=black] (0,0,0) -- (0,0,2.75) node[anchor=south]{$z$};
%draw a vector from O to A and O to B
filldraw[cyan] (A)circle (2pt)node[right]{$P(r,theta,z)$};
draw [vector guide] (O)--(1.5,1.5,0)node[midway,left]{$r$};
draw [vector guide] (A)--(1.5,1.5,0)coordinate (xy)node[midway,left,anchor=south east]{$z$};
pic["$theta$", draw=orange, -latex,thick, angle eccentricity=1.5, angle radius=0.7cm]{angle=X--O--xy};
end{tikzpicture}
end{document}

enter image description here

Correct answer by ferahfeza on April 26, 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