我正在使用以下代码使用渐近线制作一个边缘上有球的立方体,但如图所示,两个垂直边缘处的球被切掉了。我尝试调整图形的大小,但没有帮助。你能说出这里出了什么问题吗?
\documentclass{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=3dgrid}
settings.render=8;
settings.outformat='pdf';
size(600);
pen silver= RGB(192,192,192);
pen ballcolor= silver;
int L=2;
triple s,s2,ex,ey,ez,ez2,ez3,p0,p1,p2,p3;
import graph3;
currentprojection=perspective(36,29,15);
real cylRadius = 0.018;
void drawRod(triple a, triple b) {
surface rod = extrude(scale(cylRadius)*unitcircle, axis=length(b-a)*Z);
triple orthovector = cross(Z, b-a);
if (length(orthovector) > .01) {
real angle = aCos(dot(Z, b-a) / length(b-a));
rod = rotate(angle, orthovector) * rod;
}
draw(shift(a)*rod);
}
real r = 0.08;
surface site = scale3(r)*unitsphere;
real factor=1;
real distx = 1;
real disty = 1;
real distz = 1;
for(int i=1;i<=L;++i)
{
for(int j=1;j<=L;++j)
{
for(int k=1;k<=2;++k)
{
ex=((i+0.5)*distx,j*disty,k*distz);
ey=(i*distx,(j+0.5)*disty,k*distz);
ez=(i*distx,j*disty,(k+0.5)*distz);
ez2=(i*distx,j*disty,(k-0.25)*distz);
ez3=(i*distx,j*disty,(k+0.25)*distz);
if (i < L && (k==1 || k==2) )
{
s=(i*distx,j*disty,k*distz);;
//draw(shift(s) * (O -- (distx)*X),p=black+0.7pt);
draw(shift(ex)*site,ballcolor);
s2=((i+1)*distx,j*disty,k*distz);
drawRod(s,s2);
}
if (j < L && (k==1 || k==2))
{
s=(i*distx,j*disty,k*distz);;
//draw(shift(s) * (O -- (disty)*Y),p=black+0.7pt);
draw(shift(ey)*site,ballcolor);
s2=(i*distx,(j+1)*disty,k*distz);
drawRod(s,s2);
}
if (k < 2)
{
s=(i*distx,j*disty,k*distz);;
//draw(shift(s) * (O -- (distz)*Z),p=black+0.7pt);
s2=(i*distx,j*disty,(k+1)*distz);
drawRod(s,s2);
draw(shift(ez)*site,ballcolor);
}
}
}
}
\end{asypicture}
\end{document}