I'm trying to do some figures with asymptote, which is new to me and every step is a painful trial an error. I especially need to use the arc command in 3D:

path3 arc(triple c, real r, real theta1, real phi1, real theta2, real phi2,
      triple normal=O);

But I can't figure how to select the angle. I read the documentation, but it hasn't help me. Any good tutorials?

  • @SeanAllred Yes, but this is really basic and doesn't help me with the 3D arc command. Jul 23, 2013 at 15:00
  • 1
    Other than the documentation, often times this stuff is exactly by trial and error. You learn as you go. Perhaps you can apply a transformation to the entire section of the image? Jul 23, 2013 at 15:07
  • 2
    @SeanAllred: Perhaps the reason is that Asymptote has no good tutorial to compare with the tutorials in the tikz manual. Aug 4, 2013 at 13:50
  • 6
    I have written a tutorial that may be found at math.uchicago.edu/~cstaats/Charles_Staats_III/…. I'm not posting it as an answer because I have yet to say anything about three-dimensional images, but the discussion of arcs on pages 12-14 may nevertheless be useful. Nov 8, 2013 at 19:42

1 Answer 1


From what I understand, arcs are defined mostly in two different ways:

  1. path3 arc=arc(center,starting point,end point)
  2. path3 arc=arc(center,theta1,phi1,theta2,phi2)

In the first case, the starting and end points are defined through Cartesian coordinates, while in the second case, they are defined through spherical coordinates. I think there are other ways when you know the normal of the plane in which the arc is drawn. Have a look at the code below and the corresponding figure.

// command line compilation: asy -f pdf MyFig
if(!settings.multipleView) settings.batchView=false;

import solids;
import three;

// distances: radius and length
real r=.4, ar=.5;

// sphere to visualize the various arcs
revolution S=sphere(O,r);

// axes

/////////////////////// blue arc //////////////////////////
// starting point in spherical coordinates
real theta=0, phi=0;
real x1=r*sin(theta)*cos(phi), y1=r*sin(theta)*sin(phi), z1=r*cos(theta);
// end point
real theta=pi/2, phi=0;
real x2=r*sin(theta)*cos(phi), y2=r*sin(theta)*sin(phi), z2=r*cos(theta);

////////////////////// green arc //////////////////////////
// starting point
real theta=0, phi=3*pi/4; 
real x1=r*sin(theta)*cos(phi),y1=r*sin(theta)*sin(phi),z1=r*cos(theta);
// end point
real theta=pi/3, phi=3*pi/4;
real x2=r*sin(theta)*cos(phi), y2=r*sin(theta)*sin(phi),z2=r*cos(theta);

/////////////////// other examples ////////////////////////
// arc(center,starting point,end point))
// arc(center,radius,theta1,phi1,theta2,phi2)
// almost like the blue arc but with phi=10 degrees and different ends
// almost like the black arc but with phi=30 degrees

enter image description here

You must log in to answer this question.

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