我嘗試使用圓柱連接器繪製兩種顏色的黏合,如下圖所示:
所以我編寫了以下程式碼,但我不知道如何在連接圓柱體中獲得雙色:
\documentclass{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}
import three;
settings.render=8;
settings.prc=false;
size(300);
currentprojection=perspective((45,45,30));
material sphereHfcolor = material(diffusepen=royalblue, gray(0.05), specularpen=white);
material sphereGecolor = material(diffusepen=red, gray(0.05), specularpen=white);
material cylcolor = material(diffusepen=white, black);
real cylRadius = 0.2;
real HfRadius = 0.65;
real GeRadius = 0.55;
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, surfacepen=cylcolor);
}
void drawHf(triple center) {
draw(shift(center)*scale3(HfRadius)*unitsphere, surfacepen=sphereHfcolor);
}
void drawGe(triple center) {
draw(shift(center)*scale3(GeRadius)*unitsphere, surfacepen=sphereGecolor);
}
triple Cd = 2X+1.15Y+14.74Z;
triple Fb = 4X+12.75Z;
drawRod(Fb,Cd);
drawHf(Cd);
drawGe(Fb);
\end{asy}
\end{document}