# Mod causing artifacts in ParametricPlot3D

I used NDSolve and ParametricPlot3D to plot geodesics on a misshapen "torus", like so: I wanted to treat it as a surface of revolution, and then simply use Mod[x[t],2Pi] to have each geodesic loop back onto this single portion of the surface. However, as you can see, there are some strange artifacts on graph when I use Mod. If I treat the surface like normal, then there are no artifacts, so I know it's not part of the calculation.

How should I go about getting these to disappear? Ideally, I'd like to plot geodesics for large times, and watch the path. However every time the path leaves one end, it produces one of these artifacts, which clutters up the picture considerably.

• Could you give an example of the code you use to produce this image? My guess is that the path you make when you use Modwill just simply join the start and end points with a straight line, hence giving rise to the artefacts. Most likely you will need to plot each segment separately. – Dunlop Oct 31 '16 at 6:34
• Looks like a job for Exclusions -> Sin[2t] == 0. – Rahul Oct 31 '16 at 6:38
• Here is the code for the path (sorry, I accidentally posted the line of code for the surface before): ParametricPlot3D[ Evaluate[{Mod[xx[x[t], \[Theta][t]], 2 \[Pi]], yy[x[t], \[Theta][t]], zz[x[t], \[Theta][t]]} /. soln], {t, 0, 100}] I just added Exclusions -> {Sin[2 t] == 0} to the ParametricPlot3d, but it didn't do anything. – Patch Oct 31 '16 at 6:44
• xx[x[t], \[Theta][t]], etc are the x, y, and z component functions. Each depends on the x and theta parameters, which were solved for by NDSolve. – Patch Oct 31 '16 at 6:45
• @Patch I would try to see if you get the same behaviour with systems where you know the geodesics and you have analytical equations such as: Show[RevolutionPlot3D[{2 + Sin[t], t}, {t, 0, 2 \[Pi]}, PlotStyle -> White], ParametricPlot3D[{2 + Sin[t], 0, Mod[t, 2 \[Pi]]}, {t, 0, 4 \[Pi]}, PlotStyle -> Red]] For this example I don't get the straight lines? Is this similar enough to what you did based on your numerical solution? – Dunlop Oct 31 '16 at 7:37