I am trying to draw multiple colored one-dimensional parametric curves in three dimensional euclidean space. The curves themselves do not intersect in 3d, but sometimes their projections intersect when projected into 2d for visualization. In these cases, I would like the color at the intersection to be the color of the curve 'in front.'

The problem is that the curves are not strictly ordered (they could be knot-like) so I have some variant of the painter's problem, except a bit simpler because all my objects are one-dimensional and they do not intersect in 3d.

Is there a nice LaTeX or related thing that could help me with this? I've looked at examples for asymptote and some other ps and tikz packages but I can't find a nice example where this is done automatically.

Currently my work-around is to break all of the curves into tiny segments and then depth sort. This works as long as the segments are small relative to the minimum distance between curves in 3d, I think. But it is a hack and is ugly.


1 Answer 1


Doing these computations in tex is usually not a pretty sight, so Z-ordering is mostly absent in these plotting tools. I believe you need to look into an external tool, like sketch which can generate the tikz code for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .