TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to use the Magenta cylinder from dandelin spheres, but I want to have the illusion that the cylinder goes to infinity in the positive z direction.

I am ignoring the rest of the code since it isn't necessary.

How can I produce such an illusion?

Just removing the top circle wouldn't do it in my eyes.

When I show a plane extending to infinity, I have it look like

enter image description here

so the edges are uniform.

enter image description here

share|improve this question
You could just extend the lines a little bit (randomnized)? – Qrrbrbirlbel Oct 3 '13 at 19:42
I would try and do a waved circle boundary on the thick magenta line, however your skewed coordinate system does not make this my trivial thing to do. However a neat trick which is quite nice is to add:\draw[magenta,very thick] (1,0,{2*\h}) % upper circle \foreach \t in {10,20,...,360} {--({cos(\t)},{sin(\t)*cos(\t)},{2*\h})}--cycle; and you will get the infinity sign... ;) – zeroth Oct 3 '13 at 19:47
I've always seen extended cylinders portrayed using a curvy edge, something like length = l + sine(2x) where x is that angle around the cylinder. – John Kormylo Oct 4 '13 at 14:30
up vote 5 down vote accepted

Option 1
As discussed in the comments. Apply a sinusoidal shape to the upper edge of the cylinder. This is common for drawings of pipes and shafts in engineering, see US Patent 6338336.

I implemented that solution using the following modifications to the TeXample code:

\def\amp{0.25} % amplitude of sine wave
\def\phase{-90} % phase shift (rotates sine wave around the cylinder)
\foreach \t in {20,40,...,360}% generatrices
  \draw[magenta,dashed] ({cos(\t)},{sin(\t)},0)
  \draw[magenta,very thick] (1,0,0) % lower circle --- unchanged
    \foreach \t in {5,10,...,360}
  \draw[magenta,very thick] (1,0,{2*\h+\amp*sin(\phase)}) % upper circle
    \foreach \t in {10,20,...,360}

This draws the upper circle in a sinusoidal shape. The amplitude and phase shift can be adjusted to your liking.

The result:

enter image description here

Option 2
One other method I thought of is to fade out the dashed vertical lines. This could also be used in conjunction with Option 1, but this one is shown on its own here.

I could not get my fading method to work properly with a dashed line, and the fadings library seems to not play nicely with 3D coordinates. So I've made the "generatrices" magenta!50 from z=0 to z=2*\h with a transition to magenta!0 after that.

The relevant code:

\foreach \t in {20,40,...,360}{% generatrices
  \draw[magenta!50] ({cos(\t)},{sin(\t)},0)
    --({cos(\t)},{sin(\t)},{2.0*\h}) coordinate (temp);
  \foreach \i in {50,49,...,0}
    \draw[magenta!\i] (temp) -- ++(0,0,0.02) coordinate (temp);

Additionally, comment out the drawing of the upper circle. This gives the result:

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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