TeX - LaTeX Asked on December 13, 2021
I want to draw a crystal structure in asymptote and want to draw an 3d Arrow over the rod from the orange atom to the white atom? I have tried draw(Ed -- Ea, red, arrow=Arrow3());
but the size of the arrow is too small – how can I change that?
Here is my code:
documentclass{article}
usepackage{asymptote}
usepackage{lipsum}
begin{document}
lipsum[2-4]
begin{figure}
centering
begin{asy}
import three;
settings.render=8;
settings.prc=false;
size(5cm);
defaultpen(fontsize(10pt));
currentprojection=perspective((45,-90,15));
//currentprojection = orthographic((8,5,4));
//currentprojection = oblique;
material sphereCcolorNitrogen = material(diffusepen=orange, ambientpen=gray(0.1) , specularpen=white);
material sphereCcolorVac = material(diffusepen=white, ambientpen=white , specularpen=white);
material sphereCcolorCarbon = material(diffusepen=black, ambientpen=gray(0.1), specularpen=white);
material cylcolor = material(diffusepen=white, ambientpen=white);
real cylRadius = 0.05;
real sphereRadius = 0.25;
real sphereRadiusN = 0.35;
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 drawCarbon(triple center) {
draw(shift(center)*scale3(sphereRadius)*unitsphere, surfacepen=sphereCcolorCarbon);
}
void drawNitrogen(triple center) {
draw(shift(center)*scale3(sphereRadiusN)*unitsphere, surfacepen=sphereCcolorNitrogen);
}
void drawVac(triple center) {
draw(shift(center)*scale3(sphereRadius)*unitsphere, surfacepen=sphereCcolorVac);
}
triple Aa = 2X;
triple Ab = 2Y;
triple Ac = 4X+2Y;
triple Ad = 2X+4Y;
triple Ae = 2Z;
triple Ba = 4Y+2Z;
triple Bb = 4X+4Y+2Z;
triple Ca = 4X+2Z;
triple Cb = 2Y+4Z;
triple Cc = 2X+4Z;
triple Cd = 4X+2Y+4Z;
triple Da = 2X+4Y+4Z;
triple Db = 1X+3Y+3Z;
triple Ea = 3X+1Y+3Z;
triple Eb = 3X+3Y+1Z;
triple Ec = 1X+1Y+1Z;
triple Ed = 2X+2Y+2Z;
triple Ll = -0.6X-0.25Y;
triple Lm = 0.6X+0.75Y+1Z;
triple xx = -3X+4Y;
triple xxx = -1.8X+4Y;
triple yy = -3X+4Y;
triple yyy = -3X+2.8Y;
triple zz = -3X+4Y;
triple zzz = -3X+4Y+1.2Z;
//label("$N$",Ll);
//label("$V$",Lm);
drawRod(Ec,Aa);
drawRod(Ec,Ab);
drawRod(Ec,Ae);
drawRod(Ec,Ed);
drawRod(Db,Ed);
drawRod(Db,Cb);
drawRod(Db,Da);
drawRod(Db,Ba);
drawRod(Eb,Ed);
drawRod(Eb,Ac);
drawRod(Eb,Ad);
drawRod(Eb,Bb);
drawRod(Ea,Ed);
drawRod(Ea,Ca);
drawRod(Ea,Cc);
drawRod(Ea,Cd);
drawCarbon(Aa);
drawCarbon(Ab);
drawCarbon(Ac);
drawCarbon(Ad);
drawCarbon(Ae);
drawCarbon(Ba);
drawCarbon(Bb);
drawCarbon(Ca);
drawCarbon(Cb);
drawCarbon(Cc);
drawCarbon(Cd);
drawCarbon(Da);
drawCarbon(Db);
drawNitrogen(Ea);
drawCarbon(Eb);
drawCarbon(Ec);
drawVac(Ed);
draw(Ed -- Ea, red, arrow=Arrow3());
draw(xx -- xxx, arrow=Arrow3, L=Label("$y$", position=EndPoint));
draw(yy -- yyy, arrow=Arrow3, L=Label("$x$", position=EndPoint));
draw(zz -- zzz, arrow=Arrow3, L=Label("$z$", position=EndPoint));
// Frame
material framecolor = material(diffusepen=white, ambientpen=black);
void drawFrame(triple a, triple b) {
surface rod = extrude(scale(.2*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=framecolor);
draw(shift(b)*scale3(.2*cylRadius)*unitsphere, surfacepen=framecolor);
}
drawFrame((0,0,0),4X);
drawFrame((0,0,0),4Y);
drawFrame((0,0,0),4Z);
drawFrame(4X,4X+4Y);
drawFrame(4X,4X+4Z);
drawFrame(4Y,4Y+4X);
drawFrame(4Y,4Y+4Z);
drawFrame(4Z,4X+4Z);
drawFrame(4Z,4Y+4Z);
drawFrame(4X+4Y+4Z,4Y+4Z);
drawFrame(4X+4Z,4X+4Y+4Z);
drawFrame(4X+4Y,4X+4Y+4Z);
end{asy}
end{figure}
lipsum[2-4]
end{document}
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP