想要制作以下矩形框

想要制作以下矩形框

想要在 TeX 中制作以下矩形框。可以吗?

在此处输入图片描述

答案1

另一个模板。您可以使用旋转来ellipse代替circle以获得最佳可视化效果。

\documentclass{article}
\usepackage{tikz}
\usepackage{3dplot}

\begin{document}
\tdplotsetmaincoords{60}{60}
\begin{tikzpicture}
    [tdplot_main_coords,
        grid/.style={very thin,gray},
        axis/.style={->,blue,thick},
        cube/.style={opacity=.5,very thick,fill=red}]

    %draw the axes
    \draw[axis] (0,0,0) -- (4,0,0) node[anchor=west]{$x$};
    \draw[axis] (0,0,0) -- (0,10,0) node[anchor=west]{$y$};
    \draw[axis] (0,0,0) -- (0,0,3) node[anchor=west]{$z$};
    %draw the bottom of the cube
    \draw[cube] (0,0,0) -- (0,7,0) -- (3,7,0) -- (3,0,0) -- cycle;

    %draw the back-right of the cube
    \draw[cube] (0,0,0) -- (0,7,0) -- (0,7,2) -- (0,0,2) -- cycle;

    %draw the back-left of the cube
    \draw[cube] (0,0,0) -- (3,0,0) -- (3,0,2) -- (0,0,2) -- cycle;


    %draw the front-right of the cube
    \draw[cube,yellow] (3,0,0) -- (3,7,0) -- (3,7,2) -- (3,0,2) -- cycle;

    %draw the front-left of the cube
    \draw[cube] (0,7,0) -- (3,7,0) -- (3,7,2) -- (0,7,2) -- cycle;

    %draw the top of the cube
    \draw[cube,blue] (0,0,2) -- (0,7,2) -- (3,7,2) -- (3,0,2) -- cycle;

    %draw dashed rect
    \draw[cube,dashed] (1.5,0,0) -- (1.5,0,2) -- (1.5,7,2) -- (1.5,7,0) -- cycle;

    %draw circles
    \node[circle,draw,thick,minimum size=0.5cm] (fc) at (3,3.5,1) {};
    \node[circle,draw,thick,dashed,minimum size=0.5cm] (fcd) at (1.5,3.5,1) {};

    %draw circle lines
    \draw [thick] (fc.210)-- (fcd.210)--++(180:1) coordinate (A);
    \draw [thick] (fc.60)-- (fcd.60)--++(180:1) coordinate (B);
    \draw [thick] (B) to[bend right=60] (A);

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

仅用于 PSTricks 模板。我将其设置为 wiki 答案,请随意编辑。

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-solides3d}
\begin{document}

\begin{pspicture}[viewpoint=30 -10 10 rtp2xyz,Decran=30,lightsrc=viewpoint](-2,-2)(8,6)
    \psSolid[object=cylindrecreux,h=2,r=1,fillcolor=cyan,ngrid=20 20,grid=false,RotY=90](0,2.5,1.5)
    \psSolid[object=prisme,action=draw,base=0 0 3 0 3 5 0 5,h=3]
    \axesIIID[labelsep=.5](0,5,0)(6,7,4)
\end{pspicture}
\end{document}

在此处输入图片描述

相关内容