0
$\begingroup$

I borrowed Circle3D from here How to draw a Circle in 3D on a sphere and wrote the code below. Maybe you can guess: The red and green arcs are rotating as I want them to - about the z-axis.

But I want one end of the red and green arcs to be always on the z-axis at the point where the other arcs hit the z-axis. And, I want the other end of the red and green arcs to be always on the arc connecting the y-axis to the x-axis.

Figure 3 here is close to what I want in the end.

I can see that I need calculate the {start,stop} values for 'angle' arg to Circle3D depending on the positions of the red and green arcs; i.e. depending on phi.

Can you tell me how? Or, maybe there's an alternative to Circle3D?

Can you describe how Circle3D works? I have no idea. For some values of 'angle', Circle3D seems to try to draw a closed curve. What is up with that?

circle3D[centre_ : {0, 0, 0}, radius_ : 1, normal_ : {0, 0, 1}, angle_ : {0, 2 Pi}] := 
  Composition[
   Line, 
   Map[RotationTransform[{{0, 0, 1}, normal}, centre], #] &, 
   Map[Append[#, Last@centre] &, #] &, 
   Append[DeleteDuplicates[Most@#], Last@#] &, Level[#, {-2}] &, 
   MeshPrimitives[#, 1] &, DiscretizeRegion, If][
      First@Differences@angle >= 2 Pi, 
      Circle[Most@centre, radius], 
      Circle[Most@centre, radius, angle
   ]
  ]

theta = 60 Degree;
phi = -45 Degree;
Pic[theta_, phi_] := (
  dTheta = dPhi = 5 Degree;
  r = 1;
  ax = Arrow[{{0, 0, 0}, {1.3, 0, 0}}];
  ay = Arrow[{{0, 0, 0}, {0, 1.2, 0}}];
  az = Arrow[{{0, 0, 0}, {0, 0, 1.2}}];
  tx = Text[Style["X", FontSize -> 8], {1.35, .1, -.01}];
  ty = Text[Style["Y", FontSize -> 8], {0, 1.25, 0}];
  tz = Text[Style["Z", FontSize -> 8], {0, 0, 1.25}];
  cx = circle3D[{0, 0, 0}, 1, {1, 0, 0}, {Pi/2, Pi}];
  cy = circle3D[{0, 0, 0}, 1, {0, 1, 0}, {-90 Degree, 0 Degree}];
  cz = circle3D[{0, 0, 0}, 1, {0, 0, 1}, {0, 90 Degree}];
  cb = circle3D[{0, 0, r*Cos[theta]}, r*Sin[theta], {0, 0, 1}, {0, 90 Degree}];
  ct = circle3D[{0, 0, r*Cos[theta + dTheta]}, r*Sin[theta + dTheta], {0, 0, 1}, {0, 90 Degree}];
  cl = circle3D[{0, 0, 0}, r, {r*Sin[phi],        r*Cos[phi], 0},        {-Pi/4, .254*Pi}];
  cr = circle3D[{0, 0, 0}, r, {r*Sin[phi + dPhi], r*Cos[phi + dPhi], 0}, {-Pi/4, .254*Pi}];
  Graphics3D[
    {Arrowheads[.015], 
    Gray, cx, cy, cz, ax, ay, az, tx, ty, tz, cb, ct, Red, cl, Green, cr}, 
    Boxed -> False, ViewPoint -> {3, 1, 1}, 
    PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}, {-1.5, 1.5}}]
  )

Animate[Pic[theta, phi], {theta, 30 Degree, 80 Degree}, {phi, -15 Degree, -75 Degree}]
$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Oct 4 '21 at 22:03
2
$\begingroup$

Maybe this result?

Show[Graphics3D[{Opacity[.8], Sphere[], 
   Arrow[Tube[{{0, 0, 0}, {0, 0, 1.3}}]]}], 
 ParametricPlot3D[
  FromSphericalCoordinates[{r, θ, φ}] /. {{r -> 
       1, φ -> π/3}, {r -> 1, φ -> π/4}} //
    Evaluate, {θ, 0, π/2}, PlotStyle -> {Red, Green}], 
 Boxed -> False, ViewPoint -> {3.06, 0.77, 1.19}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Checking but I think this will be a starting point I can use. I added a link in the question to show roughly what I want in the end. $\endgroup$
    – Ron
    Oct 5 '21 at 15:58

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.