连接三维晶格中三个节点的透明平面

连接三维晶格中三个节点的透明平面

我正在模仿晶格,如下所示:

在此处输入图片描述

该结构由通过边连接的节点创建,但外部节点与半透明平面连接,如下所示:

在此处输入图片描述 现在,我使用与本文中发布的相同的代码参考。但是我怎样才能将三个外层原子与半透明平面连接起来呢?



最小示例:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,3d}
\begin{document}
\begin{tikzpicture}[scale = 1]
%points on cube
\coordinate (B) at (0,0,4);
%center of faces
\coordinate (I) at (0,2,2); %center of face ABCD
\coordinate (L) at (2,0,2); %center of face ABFE
\coordinate (M) at (2,2,4); %center of face CBGF
%connector
\coordinate (O) at (1,1,3);
\coordinate (P) at (1,3,1);
\coordinate (Q) at (3,1,1);
\coordinate (R) at (3,3,3);
%place non-atom cube corners
\shadedraw [ball color= black] (B) circle (0.25cm);
%draw the center of each face
\shadedraw [ball color= red] (I) circle (0.25cm);
\shadedraw [ball color= red] (L) circle (0.25cm);
\shadedraw [ball color= red] (M) circle (0.25cm);
%connectors
\shadedraw [ball color= blue] (O) circle (0.45cm);
%connections from faces to O
\draw [very thick] (B) -- (O);
\draw [very thick] (I) -- (O);
\draw [very thick] (M) -- (O);
\draw [very thick] (L) -- (O);
\end{tikzpicture}
\end{document}

答案1

要绘制透明面,请使用fill opacity键。首先绘制后面的面,然后绘制原子,然后绘制前面的面。由于您选择的视角,前面的面将与后面的面完美重叠,因此您不妨不绘制它们。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,3d}
\begin{document}
\begin{tikzpicture}[scale = 1]
%points on cube
\coordinate (B) at (0,0,4);
%center of faces
\coordinate (I) at (0,2,2); %center of face ABCD
\coordinate (L) at (2,0,2); %center of face ABFE
\coordinate (M) at (2,2,4); %center of face CBGF
%connector
\coordinate (O) at (1,1,3);
\coordinate (P) at (1,3,1);
\coordinate (Q) at (3,1,1);
\coordinate (R) at (3,3,3);

% first draw faces in the back
\filldraw[fill opacity=0.2] (I) -- (M) -- (B) -- cycle;
\filldraw[fill opacity=0.2] (L) -- (M) -- (B) -- cycle;

% place non-atom cube corners
\shadedraw [ball color= black] (B) circle (0.25cm);
%draw the center of each face
\shadedraw [ball color= red] (I) circle (0.25cm);
\shadedraw [ball color= red] (L) circle (0.25cm);
\shadedraw [ball color= red] (M) circle (0.25cm);
%connectors
\shadedraw [ball color= blue] (O) circle (0.45cm);
%connections from faces to O
\draw [very thick] (B) -- (O);
\draw [very thick] (I) -- (O);
\draw [very thick] (M) -- (O);
\draw [very thick] (L) -- (O);

% draw faces in the front
\filldraw[fill opacity=0.2] (I) -- (L) -- (B) -- cycle;
\filldraw[fill opacity=0.2] (I) -- (L) -- (M) -- cycle;
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容