使用渐近线在 3D 棋盘格中的立方体中填充颜色

使用渐近线在 3D 棋盘格中的立方体中填充颜色

我使用了以下代码另一个 tikz 问题创建 3D 晶格

\documentclass{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=3dgrid}
settings.render=8;
settings.outformat='png';
size(200);
import graph3;

int L=4;
triple s;
currentprojection=perspective(27,19,11);
real r = 0.1;
surface site = scale3(r)*unitsphere;
real dist = 1.5;

for(int i=1;i<=L;++i)
{
for(int j=1;j<=L;++j)
{
for(int k=1;k<=L;++k)
{
  s=dist*(i,j,k);
  draw(shift(s)*site,red);
  if (i < L) draw(shift(s) * (O -- (dist-r)*X),
          p=blue+0.7pt);
  if (j < L) draw(shift(s) * (O -- (dist-r)*Y),
          p=gray+0.7pt);
  if (k < L) draw(shift(s) * (O -- (dist-r)*Z),
          p=green+0.7pt);
 }
 }
 }
\end{asypicture}
\end{document}

在此处输入图片描述

但我还想以棋盘格图案填充立方体内部的颜色。有没有简单的方法可以做到这一点?

编辑:我意识到我可以使用 draw(unitcube,blue)) 但可以将其扩展到长方体吗?

相关内容