1

I'm looking to draw this figure:

enter image description here

Can anyone help me to complete this work:

\documentclass[border=5pt]{standalone}
\usepackage{tikz,tikz-3dplot}
\usetikzlibrary{patterns}% 
\newcounter{iloop}
\def\relRad{0.3}
\def\RodLength{1.65}
\begin{document}
%\foreach \k in {10,20,...,200}{
\tdplotsetmaincoords{60}{110}%\110
\begin{tikzpicture}[scale=5,tdplot_main_coords,important line/.style={red}]
\useasboundingbox[tdplot_screen_coords] (-2.5,-1.5) rectangle (3,2);
\coordinate (O) at (0,0,0);
\node[red, left] at (O) {$O$};
\begin{scope}[purple]
 \draw[thick,->] (O) -- (1.5,0,0) node[anchor=north]{$X$};
 \draw[thick,->] (O) -- (0,1.5,0) node[anchor=west]{$Y$};
 \draw[thick,->] (O) -- (0,0,1.5) node[anchor=south]{$Z=Z_0$};
 \draw[thick,->] (O) -- (0.3,0,0) node[anchor=north, left]{$\vec i$};
 \draw[thick,->] (O) -- (0,0.3,0) node[near end, below]{$\vec j$};
 \draw[thick,->] (O) -- (0,0,0.3) node[anchor=south, right]{$\vec k$};
\end{scope}
% \draw [opacity=1,important line] (-0.5,-0.5,1) -- (0.5,0.5,1) -- (0,0,0) -- cycle;%big triangle
 \begin{scope}[canvas is xy plane at z=1]
  \draw[important line] (\tdplotmainphi-15:0.5)
  -- (O) -- (\tdplotmainphi+180+15:0.5)   ;
  \draw[important line] (0,0) circle [radius=0.45cm];
  \draw[ultra thick,shorten >=-1.5cm] (O) --  (\tdplotmainphi-15:0.5)
  node[pos=1.3,above right]{$(\Delta)$};
  \path  (\tdplotmainphi-15:0.5) node[fill,circle,inner
  sep=3pt,black,label=right:$M$]{};
 \end{scope} 

\tdplotsetrotatedcoords{30}{40}{10}%%changed
\begin{scope}[tdplot_rotated_coords,blue]
 \draw[thick,->] (O) --++ (1.5,0,0) node[anchor=north]{$X_1$};
 \draw[thick,->] (O) --++ (0,1.5,0) node[anchor=west]{$Y_1$};
 %\draw[thick,->] (O) --++ (0,0,1.5) node[anchor=south]{$z_s$};
 \draw[thick,->] (O) --++ (0.3,0,0) node[anchor=north, left]{$\vec e_{\rho}$};
 \draw[thick,->] (O) --++ (0,0.3,0) node[near end, left]{$\vec e_{\varphi}$};
 %\draw[thick,->] (O) --++ (0,0,0.3) node[anchor=south, right]{$\vec k_s$};
\end{scope}
\end{tikzpicture}%}
\end{document}

that is what I can get, after modification: enter image description here

5
  • I can't compile your code. Where is important line defined?
    – fractal
    Dec 21, 2019 at 9:32
  • Interestingly the figure you are trying to reproduce is slightly wrong: the point M is misplaced on the ellipse.
    – Arnaud
    Dec 21, 2019 at 11:27
  • yes, but i can't draw the cone
    – moradov
    Dec 21, 2019 at 12:22
  • Of course an alternative would be to create your picture with an outside program and include the picture in you latex document.
    – Arnaud
    Dec 21, 2019 at 15:59
  • I removed one of my comment because I had not tried to read your code, so I did not realize you are using tikz-3dplot.
    – Arnaud
    Dec 21, 2019 at 16:11

1 Answer 1

3

This is mainly to say that you can use canvas is xy plane at z=1 to draw the circle of the cone. Other than that, there are quite a few things that are very strange in the code beyond the fact that important line is not defined, as mentioned in the comment. Any chance you could consider cleaning up these things before posting the code here?

\documentclass[border=5pt]{standalone}
\usepackage{tikz,tikz-3dplot}
\usetikzlibrary{patterns}% 
\newcounter{iloop}
\def\relRad{0.3}
\def\RodLength{1.65}
\begin{document}
%\foreach \k in {10,20,...,200}{
\tdplotsetmaincoords{60}{110}%\110
\begin{tikzpicture}[scale=5,tdplot_main_coords,important line/.style={red}]
\useasboundingbox[tdplot_screen_coords] (-2.5,-1.5) rectangle (3,2);
\coordinate (O) at (0,0,0);
\node[red, left] at (O) {$O$};
\begin{scope}[purple]
 \draw[thick,->] (O) -- (1.5,0,0) node[anchor=north]{$X$};
 \draw[thick,->] (O) -- (0,1.5,0) node[anchor=west]{$Y$};
 \draw[thick,->] (O) -- (0,0,1.5) node[anchor=south]{$Z=Z_0$};
 \draw[thick,->] (O) -- (0.3,0,0) node[anchor=north, left]{$\vec i$};
 \draw[thick,->] (O) -- (0,0.3,0) node[near end, below]{$\vec j$};
 \draw[thick,->] (O) -- (0,0,0.3) node[anchor=south, right]{$\vec k$};
\end{scope}
% \draw [opacity=1,important line] (-0.5,-0.5,1) -- (0.5,0.5,1) -- (0,0,0) -- cycle;%big triangle
 \begin{scope}[canvas is xy plane at z=1]
  \draw[important line] (\tdplotmainphi-15:0.5)
  -- (O) -- (\tdplotmainphi+180+15:0.5)   ;
  \draw[important line] (0,0) circle [radius=0.5cm];
  \draw[ultra thick,shorten >=-1.5cm] (O) --  (\tdplotmainphi-15:0.5)
  node[pos=1.3,above right]{$(\Delta)$};
  \path  (\tdplotmainphi-15:0.5) node[fill,circle,inner
  sep=3pt,black,label=right:$M$]{};
 \end{scope} 

\tdplotsetrotatedcoords{30}{40}{10}%%changed
\begin{scope}[tdplot_rotated_coords,blue]
 \draw[thick,->] (O) --++ (1.5,0,0) node[anchor=north]{$X_1$};
 \draw[thick,->] (O) --++ (0,1.5,0) node[anchor=west]{$Y_1$};
 %\draw[thick,->] (O) --++ (0,0,1.5) node[anchor=south]{$z_s$};
 \draw[thick,->] (O) --++ (0.3,0,0) node[anchor=north, left]{$\vec e_{\rho}$};
 \draw[thick,->] (O) --++ (0,0.3,0) node[near end, left]{$\vec e_{\varphi}$};
 %\draw[thick,->] (O) --++ (0,0,0.3) node[anchor=south, right]{$\vec k_s$};
\end{scope}
\end{tikzpicture}%}
\end{document}

enter image description here

Here is a version that is an arguably a bit more faithful representation of your screen shot. As pointed out by Arnaud, you probably need other rotation angles. So here is something that looks IMHO OK.

\documentclass[border=5pt]{standalone}
\usepackage{tikz,tikz-3dplot}
\usetikzlibrary{patterns}% 
\def\relRad{0.3}
\def\RodLength{1.65}
\begin{document}
%\foreach \k in {10,20,...,200}{
\tdplotsetmaincoords{60}{110}%\110
\begin{tikzpicture}[scale=5,tdplot_main_coords,important line/.style={red},
    >=stealth]
\useasboundingbox[tdplot_screen_coords] (-2.5,-1.5) rectangle (3,2);
\coordinate (O) at (0,0,0);
\node[red, left] at (O) {$O$};
\begin{scope}[purple]
 \draw[thick,->] (O) -- (1.5,0,0) node[anchor=north]{$X$};
 \draw[thick,->] (O) -- (0,1.5,0) node[anchor=west]{$Y$};
 \draw[thick,->] (O) -- (0,0,1.5) node[anchor=south]{$Z=Z_0$};
 \draw[thick,->] (O) -- (0.3,0,0) node[anchor=north, left]{$\vec i$};
 \draw[thick,->] (O) -- (0,0.3,0) node[near end, above right]{$\vec\jmath$};
 \draw[thick,->] (O) -- (0,0,0.3) node[anchor=south, right]{$\vec k$};
\end{scope}
% \draw [opacity=1,important line] (-0.5,-0.5,1) -- (0.5,0.5,1) -- (0,0,0) -- cycle;%big triangle
 \begin{scope}[canvas is xy plane at z=1]
  \draw[important line] (\tdplotmainphi-15:0.5)
  -- (O) -- (\tdplotmainphi+180+15:0.5)   ;
  \draw[important line] (0,0) circle [radius=0.5cm];
  \draw[ultra thick,shorten >=-1.5cm] (O) --  (\tdplotmainphi-15:0.5)
  node[pos=1.3,above right]{$(\Delta)$};
  \path  (\tdplotmainphi-15:0.5) node[fill,circle,inner
  sep=3pt,black,label=right:$M$](M) {};
 \end{scope} 

\tdplotsetrotatedcoords{75}{0}{0}%%changed
\begin{scope}[tdplot_rotated_coords,blue]
 \draw[thick,->] (O) --++ (1.5,0,0) node[anchor=north]{$X_1$};
 \draw[thick,->] (O) --++ (0,1.5,0) node[anchor=west]{$Y_1$};
 %\draw[thick,->] (O) --++ (0,0,1.5) node[anchor=south]{$z_s$};
 \draw[thick,->,black] (O) --++ (0.5,0,0) coordinate(erho) node[above right]{$\vec e_{\rho}$};
 \draw[dashed,black] (M) -- (erho);
 \draw[thick,->] (O) --++ (0,0.3,0) node[near end, left]{$\vec e_{\varphi}$};
 %\draw[thick,->] (O) --++ (0,0,0.3) node[anchor=south, right]{$\vec k_s$};
\end{scope}
\end{tikzpicture}%}
\end{document}

enter image description here

8
  • I agree with... Schrödinger's cat... that the math in the code is wrong. In particular the line \tdplotsetrotatedcoords{30}{40}{10}. This makes X1 point below the plane. The scanned picture in the OP shows that X1 should belong to the XY plane. Also, Y1 should belong to the ZX1 plane an cannot be orthogonal to X1.
    – Arnaud
    Dec 21, 2019 at 16:22
  • @Arnaud The math is not necessarily wrong (most likely it is) because from the screen shot it is not really clear what the OP wants to do. If that's clear, one can write a short and crisp answer. For now all I can say is that the circle needs to be projected on an appropriate plane.
    – user194703
    Dec 21, 2019 at 19:24
  • @Schrödinger'scat thank you, after compilation, I can't get what i want, i edited my question.
    – moradov
    Dec 21, 2019 at 21:12
  • @moradov You have an ancient TeX installation. canvas is xy plane at z had a bug, but this has been fixed a long time ago. If you do not want to update your TeX installation, use this fix.
    – user194703
    Dec 21, 2019 at 21:17
  • 1
    @moradov I added something. I agree with Arnaud that you probably need to change the rotation angles for the transformed coordinates.
    – user194703
    Dec 21, 2019 at 21:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .