Drawing a 3d cylinder, how to find where the surface intersects the ellipse. I want to draw a cylinder in Tikz. There are a lot of easier ways to do it on tex.stackexchange.com, but I want to do it with the 3d library so that I can (hopefully) change the direction of the axes and have it automatically redrawn. I have set it up so that the y-axis is (in 2D) at 45° from the x-axis and at $\frac{1}{2}$ the length of the other two coordinates. The parameters look like this [y={(225:-0.5 cm)},x={(0:1cm)},z={(90:1cm)}, ...], which means the y-axis is actually at 225° but in the other (negative) direction and with a "scale" factor of $\frac{1}{2}$. Then I drew the circle in the x-y plane (called "canvas" in Tikz) with a given center and radius. How Tikz then transforms this into the ellipse shown, I don't really know, otherwise I could work with the angles and probably figure it out. The complete Tikz code is:
\documentclass[border=1mm]{standalone}

\usepackage{tikz}
\usepackage{amsmath}

\usetikzlibrary{3d}

\begin{document}
 \begin{tikzpicture}[y={(225:-0.5 cm)},x={(0:1cm)},z={(90:1cm)}, thick, join=round, scale=2]
  \def \r{ 2.50 } % Defines the radius of the cylinder
  \def \h{ 7.50 } % Defines the heigth of the cylinder
  \begin{scope}[canvas is xy plane at z=0]
   \draw (0,0) circle (\r);
  \end{scope}
  \begin{scope}[canvas is xy plane at z=\h]
   \draw (0,0) circle (\r);
  \end{scope}
  \draw[->] (-4,0,0) -- node[pos=1,above] {{\Large $x$}} (4,0,0);
  \draw[->] (0,-4,0) -- node[pos=1,above] {{\Large $y$}} (0,4,0);
  \draw[->] (0,0,-4) -- node[pos=1,above] {{\Large $z$}} (0,0,4);
  \draw (\r,0,0) -- (\r,0,\h) (-\r,0,0) -- (-\r,0,\h);  
 \end{tikzpicture}
\end{document}

Which gives:

That obviously doesn't look nice. How do I find the points through which the vertical lines should go in order to make the cylinder look "closed"? Or a related question is: how do I find out the parameters of the ellipse (major and minor axes and angle with the horizontal line) given the definition of the axes above?
 A: You can think of the ellipse as obtained from a circle (which I'll assume of radius $r=1$), first by squeezing the circle to an axis-aligned ellipse, then performing a shear transformation
$(x,y)\to (x+ky,y)$ (sheared minor axis will form an angle
$\theta=90°-\arctan k$ with $x$ axis, hence $k=1$ for $\theta=45°$).
To obtain a sheared semi-minor axis with length $l$ ($l=1/2$ in the question), one must start with a semi-minor axis with length $b=l/\sqrt{1+k^2}$ (this is then the squeezing factor). Hence the equation of the ellipse before shear is:
$$
x^2+{y^2\over b^2}=1.
$$
The tangent to the sheared ellipse is "vertical" at points where the slope before shear was $-k$. Differentiating the above equation with respect to $x$ and setting $dy/dx=-k$ one gets
$$x={k\over b^2}y.$$
Inserting this into the equation of the ellipse one then finds
$$
y=\pm{b^2\over\sqrt{k^2+b^2}}\quad\text{and}\quad 
x=\pm{k\over\sqrt{k^2+b^2}}.
$$
Finally, as you need the coordinates before the circle was squeezed to an ellipse, just un-squeeze them dividing $y$ by $b$:
$$
y=\pm{b\over\sqrt{k^2+b^2}}\quad\text{and}\quad 
x=\pm{k\over\sqrt{k^2+b^2}}.
$$
These are the starting coordinates for the lateral sides of the cylinder. With the given data $k=1$, $b=\sqrt2/4$ this translates into:
$$
y=\pm{1\over3}\quad\text{and}\quad x=\pm{2\sqrt2\over3}.
$$
