# How can I draw this cone

I'm looking to draw this figure:

Can anyone help me to complete this work:

\documentclass[border=5pt]{standalone}
\usepackage{tikz,tikz-3dplot}
\usetikzlibrary{patterns}%
\newcounter{iloop}
\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[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: • I can't compile your code. Where is important line defined? 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. Dec 21, 2019 at 11:27
• yes, but i can't draw the cone 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. 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. Dec 21, 2019 at 16:11

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\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[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} 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\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[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} • 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. 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. 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
• @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
{"ft_lang_label":"__label__en","ft_lang_prob":0.5738123,"math_prob":0.99428093,"size":4400,"snap":"2022-05-2022-21","text_gpt3_token_len":1860,"char_repetition_ratio":0.20473157,"word_repetition_ratio":0.5609756,"special_character_ratio":0.42181817,"punctuation_ratio":0.25944334,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99927276,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,4,null,4,null,4,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-20T16:32:56Z\",\"WARC-Record-ID\":\"<urn:uuid:f75b2bc4-a643-4c2e-a615-a2360265f7b7>\",\"Content-Length\":\"240015\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6038bcaa-c87f-4b3d-a7ad-1d1c1a0878e1>\",\"WARC-Concurrent-To\":\"<urn:uuid:62a4b152-537b-4fa4-ba8a-86d57c92a029>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://tex.stackexchange.com/questions/521287/how-can-i-draw-this-cone\",\"WARC-Payload-Digest\":\"sha1:SYZEYA2T7MANLRLUG5VOMFJ6X5F74SFT\",\"WARC-Block-Digest\":\"sha1:WC366WSUPZWNAQMCO3VFZFXQF67DS5DS\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662533972.17_warc_CC-MAIN-20220520160139-20220520190139-00239.warc.gz\"}"}