I want to draw a 3-dimensional truncated conical picture. The only work that I could do is:




    \fill[fill=gray!50] (1,0) ellipse (0.166 and 0.5);
    \fill[fill=gray!50] (1, 0.5) -- (4, 1.5) -- (4, -1.5) -- (1, -0.5)
                        -- cycle;
                        \draw[semithick,dashed] (1,0) ellipse (0.1 and 0.4);
    \fill[fill=green!60] (4,0) ellipse (0.498 and 1.5);
    \fill[fill=gray!20] (4,0) ellipse (0.398 and 1.3);
    \draw[thick ] (4,0) ellipse (0.398 and 1.3);

    \draw[semithick,dashed] (1,0) +(90:0.5)
        arc[x radius=0.166, y radius=0.5, start angle=90, end angle=-90];
    \draw[semithick,name path=first ellipse] (1,0) +(270:0.5)
        arc[x radius=0.166, y radius=0.5, start angle=270, end angle=90];
    \draw[semithick,name path=second ellipse] (4,0) ellipse (0.498 and 1.5);

    % Find intersecions and give them a name
    \path[name path=zaxis] (0,0,0) -- (5,0,0);
    \path[name intersections={of=zaxis and first ellipse}] (intersection-1)
        coordinate (A);
    \path[name intersections={of=zaxis and second ellipse}] (intersection-1)
            coordinate (B) (intersection-2) coordinate (C);
    % Draw the z axis
    \draw[thick,->] (0,0,0) -- (A) (C) -- (5,0,0) node[anchor=west]{};
    \draw[thick, dashed] (A) -- (C);

    \draw (1, 0.5) -- (4, 1.5);
    \draw (1, -0.5) -- (4, -1.5);


2D schematic cone shown from the side, generated with LaTeX

But is it possible to draw something more like the following picture?

3D render of a cone shown from side to front


You can certainly make the plot more reminiscent of the target outcome. I did not find \thetacrit from a computation but by trial and error so you may need to readjust if you change the view angles.

\begin{tikzpicture}[tdplot_main_coords,declare function={R1=4;R2=2;h=3;}]
 \draw[tdplot_screen_coords,top color=blue!60!black,bottom color=blue!60!white] (-R1+R2,-1.2*R1) rectangle (R1+R2,1.2*R1);
  \clip plot[smooth,variable=\t,domain=0:360] ({R2*cos(\t)},0,{R2*sin(\t)});
  \fill[mantle!80!black,even odd rule] 
  plot[smooth,variable=\t,domain=\thetacrit:360-\thetacrit] ({R1*cos(\t)},-h,{R1*sin(\t)})
 -- plot[smooth,variable=\t,domain=360-\thetacrit:\thetacrit] ({R2*cos(\t)},0,{R2*sin(\t)})
 -- cycle;
 \draw[left color=mantle,right color=mantle!80,middle color=mantle!40,shading
 angle=10] plot[smooth,variable=\t,domain=-\thetacrit:\thetacrit] ({R1*cos(\t)},-h,{R1*sin(\t)})
 -- plot[smooth,variable=\t,domain=\thetacrit:-\thetacrit] ({R2*cos(\t)},0,{R2*sin(\t)})
 -- cycle;
 \draw[left color=mantle,right color=mantle!80,middle color=mantle!40,shading
 angle=190,even odd rule] plot[smooth,variable=\t,domain=0:360] ({R2*cos(\t)},0,{R2*sin(\t)})
 plot[smooth,variable=\t,domain=0:360] ({0.85*R2*cos(\t)},-0.05*h,{0.85*R2*sin(\t)});

enter image description here

If you want more real 3d features, switch to asymptote. Even with pgfplots some things can be done more automatically.

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.