Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. (%11) hc:2*x*y+2*x*z=2;
  2. (%i2) draw3d(enhanced3d=true,implicit(hc,x,-5,5,y,-5,5,z,-5,5));
  3.  
  4. % impsurf.tex :
  5. %
  6. documentclass[10pt,a4paper]{article}
  7. usepackage{lmodern}
  8. usepackage{subcaption}
  9. usepackage[inline]{asymptote}
  10. usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
  11. begin{asydef}
  12. settings.outformat="png";
  13. settings.render=8;
  14. import graph3;
  15. import contour3;
  16. currentlight=light(gray(0.8),ambient=gray(0.1),specular=gray(0.7),
  17. specularfactor=3,viewport=true,dir(42,48));
  18. pen bpen=rgb(0.75, 0.7, 0.1);
  19. material m=material(diffusepen=0.7bpen
  20. ,ambientpen=bpen,emissivepen=0.3*bpen,specularpen=0.999white,shininess=1.0);
  21. end{asydef}
  22.  
  23. %
  24. begin{document}
  25. %
  26. begin{figure}
  27. captionsetup[subfigure]{justification=centering}
  28. centering
  29. begin{subfigure}{0.49textwidth}
  30. begin{asy}
  31. size(200,0);
  32. currentprojection=orthographic(camera=(9,10,4),up=Z,target=O,zoom=1);
  33.  
  34. // ellipsoid
  35. real f(real x, real y, real z) {return (x^2)/(2^2) + (y^2)/(3^2) + (z^2)/(2^2)-1;}
  36.  
  37. draw(surface(contour3(f,(-3,-3,-3),(3,3,3),32)),m
  38. ,render(compression=Low,merge=true));
  39.  
  40. xaxis3(Label("$x$",1),-4,4,red);
  41. yaxis3(Label("$y$",1),-4,4,red);
  42. zaxis3(Label("$z$",1),-4,4,red);
  43.  
  44. end{asy}
  45. %
  46. caption{$(frac{x}{2})^2+(frac{y}{3})^2+(frac{z}{2})^2= 1$ (ellipsoid)}
  47. label{fig:1a}
  48. end{subfigure}
  49. %
  50. begin{subfigure}{0.49textwidth}
  51. begin{asy}
  52. size(200,0);
  53. currentprojection=orthographic(camera=(9,4,4),up=Z,target=O,zoom=1);
  54.  
  55. // hyperbolic cylinder
  56. real f(real x, real y, real z) {return 2*x*y + 2*x*z-1;}
  57.  
  58. draw(surface(contour3(f,(-3,-3,-3),(3,3,3),32)),m
  59. ,render(compression=Low,merge=true));
  60.  
  61. xaxis3(Label("$x$",1),-4,4,red);
  62. yaxis3(Label("$y$",1),-4,4,red);
  63. zaxis3(Label("$z$",1),-4,4,red);
  64. end{asy}
  65. %
  66. caption{$2xy + 2xz = 1$ (hyperbolic cylinder)}
  67. label{fig:1b}
  68. end{subfigure}
  69. caption{}
  70. label{fig:1}
  71. end{figure}
  72. %
  73. end{document}
  74. %
  75. % Process:
  76. %
  77. % pdflatex impsurf.tex
  78. % asy impsurf-*.asy
  79. % pdflatex impsurf.tex
  80.  
  81. documentclass[pstricks]{standalone}
  82. usepackage{pst-solides3d,pst-math}
  83. begin{document}
  84.  
  85. begin{pspicture}(-4,-4)(4,4)% the main 2D area
  86. psset{lightsrc=viewpoint,viewpoint=50 -200 20 rtp2xyz,Decran=30}
  87. pstVerb{/constA 1 def /constB 1 def }
  88. defFunction[algebraic]{hcyl0}(u,v)
  89. { constA*SINH(u) }% x=f(u)
  90. { constB*COSH(u) }% y=f(u)
  91. { v } % z=f(v)
  92. defFunction[algebraic]{hcyl1}(u,v)
  93. { constA*SINH(u) }% x=f(u)
  94. { -constB*COSH(u) }% y=f(u)
  95. { v } % z=f(v)
  96. psSolid[object=surfaceparametree,base=-2 2 -3 3,
  97. fillcolor=red!40,function=hcyl0,linewidth=0.1pslinewidth,ngrid=25]
  98. psSolid[object=surfaceparametree,base=-2 2 -3 3,
  99. fillcolor=red!40,function=hcyl1,linewidth=0.1pslinewidth,ngrid=25]
  100. gridIIID[Zmin=-3,Zmax=3](-4,4)(-4,4)
  101. end{pspicture}
  102.  
  103. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement