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}]