2
$\begingroup$

Here's my code and output:

(*Parametrisation of surface*)
s[a_, c_][u_, v_] := {(c + a Cos[v]) Cos[u],
   (c + a Cos[v]) Sin[u],
   a Sin[v]};

(*1D curves on the surface*)
band[a_, c_][v_] := s[a, c][0, v];
p1[a_, c_][u_] := s[a, c][u, 0];
p2[a_, c_][u_] := s[a, c][u + \[Pi], \[Pi] (1 + Erf[3 (u - \[Pi])])];

(*Setting a symbol to equal the plot graphics*)
sPlot = ParametricPlot3D[
   s[1, 2][u, v]
   , {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]},
   Boxed -> False, Axes -> False, Lighting -> {{"Ambient", White}}, 
   PlotStyle -> Directive[{
      RGBColor[0.95, 0.95, 1, 0.7],
      Specularity[White, 10000]
      }], Mesh -> 10, MeshStyle -> Directive[{
      RGBColor[0.5, 0.5, .5, 0.8],
      Thick}]
   , PlotPoints -> 50, RotationAction -> "Clip"];

(*Displaying the final plot*)
Show[
 sPlot,
 ParametricPlot3D[{
   band[1, 2][u], p2[1, 2][u]
   }, {u, 0, 2 \[Pi]},
  PlotStyle -> {{Black, Thickness[0.05]}, {RGBColor[0.4, 0.4, 0.8], 
     Thickness[0.03]}}], PlotRange -> All, PlotPoints -> 50
 , ImageSize -> 1000
 ]

enter image description here

Now I think the problem here is pretty obvious: it looks horrible. The black curve is especially bad, though the blue curve also displays an issue with 'bumpiness'. Here is the kind of output I want to replicate consistently:

enter image description here

As you can see, the curve intersects the plot but it still looks nice. Having said that, there are still some graphical issues (look around the front-right black spot on the sphere). Here are the things I have tried to achieve the same result with the first plot:

  • Increasing PlotPoints for all ParametricPlot3Ds
  • Tweaking the curves so they don't intersect with the surface
  • Increasing ImageSize and shrinking the output

None of these work. The second does alleviate the problem, but it becomes very obvious that the curves don't lie on the surface.

How can I fix this rendering/display error? At the very least, I would like to export these images to PNG without these graphical issues.

$\endgroup$
0
2
$\begingroup$

Perhaps ...

post-processing the Lines in the second plot in Show into Tubes:

plot2 = ParametricPlot3D[{band[1, 2][u], p2[1, 2][u]}, {u, 0, 2 Pi}, PlotPoints -> 50,
  PlotStyle -> {Black, RGBColor[0.4, 0.4, 0.8]}] /.  Line -> (Tube[#, .2] &); 

Show[sPlot, plot2, PlotRange -> All, ImageSize -> 1000]

enter image description here

$\endgroup$
4
  • $\begingroup$ Are you using Linux by any chance? ;) $\endgroup$
    – Myridium
    Jan 19 '18 at 1:59
  • $\begingroup$ @Myridium, I am using windows 10 (64b) $\endgroup$
    – kglr
    Jan 19 '18 at 2:06
  • $\begingroup$ Okay, I asked because of the aliasing in your image. I have that issue on Linux but not on Windows. I guess you may just have different settings. I'm interested in what happens to the directives like Thickness when we replace Line with Tube like this. Are there any potential side effects? $\endgroup$
    – Myridium
    Jan 19 '18 at 2:10
  • $\begingroup$ @Myridium, you need to black with the second argument of Tube to get the desired "thickness". I am not aware of potential side effects. $\endgroup$
    – kglr
    Jan 19 '18 at 2:15

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.