5

I want to make 3D in Asymptote.

My code:

> import three;
import graph3;
//import solids;
currentprojection=orthographic(8,4,2,center=true);

size(10cm);
size3(3cm,5cm,8cm);

draw(unitbox,dashed);

dot(unitbox,red);
xaxis3(Label("$x$",1),xmax=1.25,Arrow3);
yaxis3(Label("$y$",1),ymax=1.25,Arrow3);
zaxis3(Label("$z$",1),zmax=1.25,Arrow3);
xaxis3(Label("$\hat{x}$",.5),xmax=.5,Arrow3);
yaxis3(Label("$\hat{y}$",.5),ymax=.5,Arrow3);
zaxis3(Label("$\hat{z}$",.5),zmax=.5,Arrow3);
label("$O$",(0,0,0),NW);
draw ((0,0,0) --(1,1,1),Arrow3);

enter image description here

Please help me! Thank U :)

3
  • 1
    Welcome! You already have an asymptote code. What is it precisely that you are struggling with, and what you want to have help for?
    – user194703
    Aug 25, 2019 at 2:28
  • I don't know how to customize drawing angles from axes to vector r. please help me. Thank u :) Aug 25, 2019 at 2:55
  • Thank minhthien_2016 so much, edit code :) Aug 25, 2019 at 6:18

1 Answer 1

9

This is done with much help from this tutorial and uses asypictureB by the same author. You obtain the result e.g. with pdflatex -shell-escape.

\documentclass{standalone}
\usepackage{asypictureB}
\standaloneenv{asypicture}
\begin{document}
\begin{asypicture}{name=disc}
settings.outformat = "pdf";
settings.prc = false;
settings.render = 0;
import three;
import graph3;
//import solids;
currentprojection=orthographic(8,4,2,center=true);

size(10cm);
size3(3cm,5cm,8cm);

draw(unitbox,dashed);

dot(unitbox,red);
xaxis3(Label("$x$",1),xmax=1.25,Arrow3);
yaxis3(Label("$y$",1),ymax=1.25,Arrow3);
zaxis3(Label("$z$",1),zmax=1.25,Arrow3);
xaxis3(Label("$\hat{x}$",.5),xmax=.5,Arrow3);
yaxis3(Label("$\hat{y}$",.5),ymax=.5,Arrow3);
zaxis3(Label("$\hat{z}$",.5),zmax=.5,Arrow3);
label("$O$",(0,0,0),NW);
draw ((0,0,0) --(1,1,1),Arrow3);
draw(arc(c=O,0.5*X,X+Y+Z), L = Label("$\alpha$", position=MidPoint,align=(0,1)));
draw(arc(c=O,0.5*Y,X+Y+Z), L = Label("$\beta$", position=MidPoint,align=(0,1)));
draw(arc(c=O,0.5*Z,X+Y+Z), L = Label("$\gamma$", position=MidPoint,align=(0,1)));
\end{asypicture}
\end{document}

enter image description here

1
  • Thank Schrödinger's cat so much :) Aug 25, 2019 at 6:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .