1
$\begingroup$

This question already has an answer here:

I plotted the left curve using regular ParametricPlot3D. In parts where the curve overlaps itself, it is unclear which segment is in the foreground and which in the background. At least for more complicated curves, this can make it tricky to fully graps the spacial embedding.

Is there a way to achieve the effect in the right image (I did it with photoshop)? Maybe by creating some white "halo" around the curve (in some clever way)?


Minimal working code example

ParametricPlot3D[
    {Cos[t], Sin[t], 0.13 t}, {t, -10, 10},
    PlotStyle -> {Black, Thickness[0.013]},
    Axes -> None,
    Boxed -> False
]
$\endgroup$

marked as duplicate by Rahul, Community Jan 22 '18 at 15:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ @Rahul Thank you, this helped perfectly. Especially your answer. $\endgroup$ – M. Winter Jan 22 '18 at 15:10
  • $\begingroup$ @Rahul This might be a seperate question or maybe fit better below your answer in the other question, but is there a short answer to "how can I make the line in my ParametricPlot3D into a tube, so that I can apply this idea", and yes I want to use ParametricPlot3D and not Graphics3D. $\endgroup$ – M. Winter Jan 22 '18 at 15:22
  • $\begingroup$ Yes, this should probably be a separate question. And in fact, it already is, many times. Search for "ParametricPlot3D Tube" on this site. $\endgroup$ – Rahul Jan 22 '18 at 15:27
1
$\begingroup$

Even though this question is a duplicate and the problem was solved by Rahul's great answer over here, I still want to provide the full code of my solution. This isvolves how I transferred the solution to work with ParametricPlot3D.

f[t_] := {Cos[t], Sin[t], 0.2 t};
Show[
  (* the actual black curve *)
  ParametricPlot3D[
    f[t], {t, -10, 10},
    PlotStyle -> {Black, Thickness[0.013]}
  ],

  (* the tube around the curve which hides the background curve at overlaps *)
  ParametricPlot3D[
    f[t], {t, -10, 10},
    PlotStyle -> {CapForm@None, FaceForm[None, Glow[White]]},
    Lighting -> None
  ] /. Line[L_] -> Tube[L, 0.05],

  Axes -> None,
  BoxStyle -> {Gray, Opacity[0.5]},
  PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}, Automatic}
]

$\endgroup$

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