Draw this pictures from Mathematica

tikz-3dplot

I see

this pictures

enter image description here

enter image description here

The second picture is drawn with one line by Mathematica.

I tried

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
    \tdplotsetmaincoords{70}{220}
    \begin{tikzpicture} [tdplot_main_coords,c/.style={circle,fill,inner sep=1pt}]
        \path
        (0,0,0) coordinate (O)
        (0,0,2) coordinate (A);
             \draw[fill=red] (A) circle[radius=1 cm];
           \draw[fill=yellow]  (-3, -3, -2)--(-3, 3, -2) -- (3, 3, -2) --(3, -3, -2)--cycle;
\draw  (-2, 0, 2)--(2, 0, 2) -- (0, 0, 4) --cycle;
            \end{tikzpicture}
\end{document}  

I got

enter image description here

How can I draw two pictures?

Best Answer

For the first picture.

Compile on http://asymptote.ualberta.ca/.

To get the picture, simply to press buttons png and download.

settings.render=10; // important! 10 is optional.
size(7.5cm);
import solids;

currentprojection=perspective(camera=(-3,6,6));

path3 polygon=(-3,-3,-2)--(-3,3,-2)--(3,3,-2)--(3,-3,-2)--cycle,
      line=(-2,0,2)--(2,0,2)--(0,0,4)--cycle;
revolution cylinder=cylinder((0,0,-1),r=1,h=abs((0,0,1)-(0,0,-1)),(0,0,1)-(0,0,-1));
revolution sphere=sphere((0,0,2),r=1);
surface cuboid=shift(-2,-2,-2)*scale(4,4,1)*unitcube;

pen opa=opacity(.6);
draw(surface(polygon),yellow+opa,black+.7bp);
draw(line,.7bp+blue);
draw(surface(cylinder),blue+opa,render(merge=true));
//draw(surface(circle((0,0,-1),1,(0,0,-1))),pink+opa,render(merge=true));
draw(surface(circle((0,0,1),1,(0,0,1))),pink+opa,render(merge=true));
draw(cuboid,green+opa,black+.7bp);
draw(surface(sphere),red+opa);

enter image description here