1

with this program in asymptote I have to trace the meridians.

settings.outformat = "png";
settings.render = 16;
size(6cm,0);
import solids;

currentlight=Headlamp; // inutile car Headlamp est la valeur par défaut

nslice=4*nslice;
revolution boule=sphere(O,1);
draw(surface(boule),lightgrey+white+opacity(.5));
draw((0,0,1)--(0,0,-1),dashed);
dot("$P1$",(0,0,1),N);
dot("$P2$",(0,0,-1),2.2S);
dot("$O$",(0,0,0),SE);
draw(O--(1,0,0),red);
draw(O--(Cos(60),Sin(60),0),red);
triple v1= 0.4(1,0,0), v2 = 0.4(Cos(60),Sin(60),0);
draw(arc(c=O,v1,v2,normal=Z),red,arrow=Arrow3(DefaultHead2,emissive(red)),L=Label("$\varphi$",align=W, position=MidPoint)); 
for (real alpha = 90; alpha<=450; alpha+= 30)
{


     if (alpha==150) draw(arc((0,0,0),(0,0,1), (0,0,-1), (Cos(alpha),Sin(alpha),0)),red);
     if (alpha==330) draw(arc((0,0,0),(0,0,1), (0,0,-1), (Cos(alpha),Sin(alpha),0)),red + dashed);
     if (alpha != 150 && alpha != 330) draw(arc((0,0,0),(0,0,1), (0,0,-1), (Cos(alpha),Sin(alpha),0)),black);
}

But I can not draw arc in a clockwise direction with this code (this is the critic point!):

draw(arc(c=O,v1,v2,normal=Z),red,arrow=Arrow3(DefaultHead2,emissive(red)),L=Label("$\varphi$",align=W, position=MidPoint)); 

I tried:

  1. to change v1 and v2 order with the same normal (Z), but in this way i have the angle greater than ninety degrees (i need the explementar angle)
  2. to change v1 and v2 order and take normal = - Z, but in this way asymptote runs on a infinite loop.

I don't know why.

3

It took me a while to understand the question since IMHO it is not very clearly written. An additional complication arises from the fact that you did not present an MWE and seem to insist to have a special character in a comment: "défaut". All I did was to follow this great tutorial, which has the desired syntax on the bottom of p. 60. The striking difference to you code is that there the normal of the 2D arrow gets specified, too, and that it is actually +Z (and not -Z).

\documentclass[border=3.14mm]{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=arc}
settings.outformat = "png";
settings.render = 16;
size(6cm,0);
import solids;

currentlight=Headlamp; // inutile car Headlamp est la valeur par defaut

nslice=4*nslice;
revolution boule=sphere(O,1);
draw(surface(boule),lightgrey+white+opacity(.5));
draw((0,0,1)--(0,0,-1),dashed);
dot("$P1$",(0,0,1),N);
dot("$P2$",(0,0,-1),2.2S);
dot("$O$",(0,0,0),SE);
draw(O--(1,0,0),red);
draw(O--(Cos(60),Sin(60),0),red);
triple v1= 0.4*(1,0,0), v2 = 0.4*(Cos(60),Sin(60),0);
//draw(arc(c=O,v1,v2),red,arrow=Arrow3(DefaultHead2,emissive(red)),L=Label("$\varphi$",align=W, position=MidPoint)); 
for (real alpha = 90; alpha<=450; alpha+= 30)
{
     if (alpha==150) draw(arc((0,0,0),(0,0,1), (0,0,-1), (Cos(alpha),Sin(alpha),0)),red);
     if (alpha==330) draw(arc((0,0,0),(0,0,1), (0,0,-1), (Cos(alpha),Sin(alpha),0)),red + dashed);
     if (alpha != 150 && alpha != 330) draw(arc((0,0,0),(0,0,1), (0,0,-1), (Cos(alpha),Sin(alpha),0)),black);
};

draw(arc(c=O, v2, v1, normal=-Z), red, arrow =
Arrow3(TeXHead2(normal=Z), emissive(red)),L=Label("$\varphi$",align=S, position=MidPoint));
\end{asypicture}
\end{document}

enter image description here

  • Tank you Marmot for your anwer – user273366 Nov 24 '18 at 7:45
  • indeed, the normal parameter was missing in the arrow function – user273366 Nov 24 '18 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.