daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Oct 18th, 2018 61 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. documentclass{standalone}
  2. usepackage[inline]{asymptote}
  3. begin{document}
  4.  
  5. begin{asy}
  6. size(300);
  7. import solids;
  8.  
  9.  
  10. // save predefined 2D orientation vectors
  11. pair NN=N;
  12. pair SS=S;
  13. pair EE=E;
  14. pair WW=W;
  15.  
  16. triple C1 = (-3.19898,0.68575,-0.09137);
  17. triple N1 = (-2.00788,-0.15303,-0.05472);
  18. triple H1 = (-3.17155,1.39571,-0.92422);
  19. triple H2 = (-3.31563,1.23754,0.84706);
  20. triple H3 = (-4.08519,0.05549,-0.21396);
  21. triple C2 = (-0.78815,0.67831,0.01256);
  22. triple H4 = (-1.95362,-0.69266,-0.92177);
  23. triple C3 = (0.47237,-0.18670,0.21998);
  24. triple H5 = (-0.86520,1.39211,0.84227);
  25. triple H6 = (-0.69535,1.26040,-0.91400);
  26. triple C4 = (1.73163,0.67172,0.09304);
  27. triple N2 = (0.51467,-1.32801,-0.73516);
  28. triple H7 = (0.46502,-0.59296,1.23918);
  29. triple H8 = (1.39360,-1.82407,-0.57104);
  30. triple H9 = (-0.23067,-1.96899,-0.46111);
  31. triple O1 = (1.80456,1.88884,0.13111);
  32. triple O2 = (2.86188,-0.07112,0.00360);
  33. triple H10 = (3.57354,0.59879,-0.06651);
  34.  
  35. triple[] Carbon={  
  36.   C1,C2,C3,C4,
  37. };
  38. triple[] Nitrogen={
  39.   N1,N2,
  40. };
  41. triple[] Oxygen={
  42.   O1,O2,
  43. }
  44. triple[] Hydrgeon={
  45.   C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,
  46. }
  47. void Draw(guide3 g,pen p=currentpen){
  48.   draw(
  49.     cylinder(
  50.       point(g,0),cylR,arclength(g),point(g,1)-point(g,0)
  51.     ).surface(
  52.                new pen(int i, real j){
  53.                  return p;
  54.                }
  55.              )
  56.   );
  57. }
  58. real cylR=0.062;
  59.  
  60. pen connectPen=lightgray
  61. Draw(C1--N1,connectPen)
  62. Draw(N1--C2,connectPen)
  63. Draw(C2--C3,connectPen)
  64. Draw(C3--C4,connectPen)
  65. Draw(C4--O1,connectPen)
  66. Draw(H1--C1,connectPen)
  67. Draw(H2--C1,connectPen)
  68. Draw(H3--C1,connectPen)
  69. Draw(H4--N1,connectPen)
  70. Draw(C2--H5,connectPen)
  71. Draw(C2--H6,connectPen)
  72. Draw(C3--H7,connectPen)
  73. Draw(C3--N2,connectPen)
  74. Draw(N2--H8,connectPen)
  75. Draw(N2--H9,connectPen)
  76. Draw(C4--O2,connectPen)
  77. Draw(O2--H10,connectPen)
  78.  
  79. void drawSpheres(triple[] C, real R, pen p=currentpen){
  80.   for(int i=0;i<C.length;++i){
  81.     draw(sphere(C[i],R).surface(
  82.                         new pen(int i, real j){return p;}
  83.                         )
  84.     );
  85.   }
  86. }
  87.  
  88. drawSpheres(Carbon,darkgray);
  89. drawSpheres(Nitrogen,lightblue);
  90. drawSpheres(Oxygen,red);
  91. drawSpheres(Hydrogen,lightgray);
  92. end{asy}
  93. end{document}
  94.    
  95. import settings;
  96. dir="C:Program FilesAsymptote";
  97.    
  98. documentclass{standalone}
  99. usepackage{asypictureB}
  100. begin{document}
  101. begin{asypicture}{name=crystal}
  102. size(300);
  103. import solids;
  104.  
  105. currentprojection=orthographic (
  106. camera=(8,5,4),
  107. up=(0,0,1),
  108. target=(2,2,2),
  109. zoom=0.5
  110. );
  111.  
  112. // save predefined 2D orientation vectors
  113. pair NN=N;
  114. pair SS=S;
  115. pair EE=E;
  116. pair WW=W;
  117.  
  118. triple C1 = (-3.19898,0.68575,-0.09137);
  119. triple N1 = (-2.00788,-0.15303,-0.05472);
  120. triple H1 = (-3.17155,1.39571,-0.92422);
  121. triple H2 = (-3.31563,1.23754,0.84706);
  122. triple H3 = (-4.08519,0.05549,-0.21396);
  123. triple C2 = (-0.78815,0.67831,0.01256);
  124. triple H4 = (-1.95362,-0.69266,-0.92177);
  125. triple C3 = (0.47237,-0.18670,0.21998);
  126. triple H5 = (-0.86520,1.39211,0.84227);
  127. triple H6 = (-0.69535,1.26040,-0.91400);
  128. triple C4 = (1.73163,0.67172,0.09304);
  129. triple N2 = (0.51467,-1.32801,-0.73516);
  130. triple H7 = (0.46502,-0.59296,1.23918);
  131. triple H8 = (1.39360,-1.82407,-0.57104);
  132. triple H9 = (-0.23067,-1.96899,-0.46111);
  133. triple O1 = (1.80456,1.88884,0.13111);
  134. triple O2 = (2.86188,-0.07112,0.00360);
  135. triple H10 = (3.57354,0.59879,-0.06651);
  136.  
  137. triple[] Carbon={  
  138.   C1,C2,C3,C4
  139. };
  140. triple[] Nitrogen={
  141.   N1,N2
  142. };
  143. triple[] Oxygen={
  144.   O1,O2
  145. };
  146. triple[] Hydrogen={
  147.   H1,H2,H3,H4,H5,H6,H7,H8,H9,H10
  148. };
  149.  
  150. //%place non-atom cube corners
  151.  
  152.  
  153.  
  154. real cylR=0.062;
  155.  
  156. void Draw(guide3 g,pen p=currentpen){
  157.   draw(
  158.     cylinder(
  159.       point(g,0),cylR,arclength(g),point(g,1)-point(g,0)
  160.     ).surface(
  161.                new pen(int i, real j){
  162.                  return p;
  163.                }
  164.              )
  165.   );
  166. }
  167.  
  168.  
  169. pen connectPen=lightgray;
  170. Draw(C1--N1,connectPen);
  171. Draw(N1--C2,connectPen);
  172. Draw(C2--C3,connectPen);
  173. Draw(C3--C4,connectPen);
  174. Draw(C4--O1,connectPen);
  175. Draw(H1--C1,connectPen);
  176. Draw(H2--C1,connectPen);
  177. Draw(H3--C1,connectPen);
  178. Draw(H4--N1,connectPen);
  179. Draw(C2--H5,connectPen);
  180. Draw(C2--H6,connectPen);
  181. Draw(C3--H7,connectPen);
  182. Draw(C3--N2,connectPen);
  183. Draw(N2--H8,connectPen);
  184. Draw(N2--H9,connectPen);
  185. Draw(C4--O2,connectPen);
  186. Draw(O2--H10,connectPen);
  187.  
  188. void drawSpheres(triple[] C, real R, pen p=currentpen){
  189.   for(int i=0;i<C.length;++i){
  190.     draw(sphere(C[i],R).surface(
  191.                         new pen(int i, real j){return p;}
  192.                         )
  193.     );
  194.   }
  195. }
  196.  
  197. real radC=0.15;
  198. real radN=0.2;
  199. real radO=0.2;
  200. real radH=0.1;
  201.  
  202.  
  203. drawSpheres(Carbon,radC,darkgray);
  204. drawSpheres(Nitrogen,radN,lightblue);
  205. drawSpheres(Oxygen,radO,red);
  206. drawSpheres(Hydrogen,radH,lightgray);
  207.  
  208. end{asypicture}
  209. end{document}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top