[Tex/LaTex] partially filled, tilted cylinder in TikZ

diagramstikz-pgf

I have a diagram I'd like to reproduce in TikZ:

enter image description here

Picture a can (cylinder of radius r and height L) that has liquid in it. In each diagram, the can is tilted so that the surface of the liquid just touches where the top meets the sides. In the first diagram, the liquid covers the entire bottom, while in the second, only half.

Edit: Yes, I could do this myself given the time, but I'd like to see how others would handle the 3D aspect. Is there a better way to draw a projected circle than to draw an ellipse? [There you go @Andrew.]

The optimal code would use styles and named coordinates so that one could alter the diagram by changing only a few parameters.

Best Answer

Do you want something a bit like this?

cylinders with liquid

If so, I'm afraid I don't know how to do that.


(Added in edit after question was closed. The above was produced using TikZ, contrary to my comment below. However, the code is messy and not elegant - it was a quick hack to make the joke. I've sent it privately to Matthew but I am not going to post it here. There are some interesting aspects in doing a drawing such as this one, so if anyone is interested in producing diagrams like this one then I encourage them to think carefully about which bits they could do and which would be hard, and then ask a focussed question specifically about the hard bits.)