# How to draw a sphere using asymptote from tutorial

I'm just following the tutorial from Charles Staats III

In the page of 55, the codes:

``````settings.outformat = "pdf";
settings.prc = false;
settings.render = 0;
import three;
size(5cm,0);
path3 myarc = rotate(18,Z) * Arc(c=O, normal=X, v1=-Z, v2=Z, n=10);
surface backHemisphere =
surface(myarc, angle1=0, angle2=180, c=O, axis=Z, n=10);
surface frontHemisphere =
surface(myarc, angle1=180, angle2=360, c=O, axis=Z, n=10);
draw(backHemisphere,
surfacepen=material(white+opacity(0.8),
ambientpen=white),
meshpen=gray(0.4));
draw(O--X, blue+linewidth(1pt));
draw(frontHemisphere,
surfacepen=material(white+opacity(0.8), ambientpen=white),
meshpen=gray(0.4));
``````

Cannot run properly, the error is:

``````fig01.asy: 6.17: no matching variable 'Arc'
``````

If I edit the like from

``````path3 myarc = rotate(18,Z) * Arc(c=O, normal=X, v1=-Z, v2=Z, n=10);
``````

to

``````path3 myarc = rotate(18,Z) * arc(c=O, normal=X, v1=-Z, v2=Z, n=10);
``````

It will give message:

``````fig01.asy: 6.33: no matching function 'arc(triple c, triple normal, triple v1, triple v2, int n)'
``````

Anyone know where is wrong?

• Welcome to TeX-SE! When I copy the example that starts at the bottom of p. 55 of this nice manual by Charles Staats I do not encounter any problems. In fact, this example loads `graph3` as you suggest, and according to what I find `graph` is not needed. Probably there is a simple explanation, e.g. you may be using a different manual. To understand what's going on could you please add a link to the manual you are referring to?
– user121799
May 27, 2019 at 1:23
• @marmot It is that just a line of codes used to debug, actually not necessary. But it can also remind that for 2D case, there is a `graph` allow higher precision. Finally, the documents I'm referring is just from the asymptote website, it should be up-to-date.
– rig
May 28, 2019 at 2:04
• Do you have a link that others can check?
– user121799
May 28, 2019 at 2:07
• Sure, that is from CTAN, anorien.csc.warwick.ac.uk/mirrors/CTAN/graphics/asymptote/doc/…
– rig
May 28, 2019 at 2:11
• Sorry, you write in your question "I'm just following the tutorial from Charles Staats III", but according to what I find the example in this tutorial runs just fine. The link you provide is the asymptote manual, not Charles Staats' tutorial.
– user121799
May 28, 2019 at 2:14

Ok, after check with documents, I know why that is happen. To use the function `Arc` in `path3`, it required extra package,
``````import graph3;
Also, `Arc`, `Circle` function in 2D case require package `graph`
``````import graph;