I’m using Tikz to create an isometric view of a cylinder. The flat bases of the cylinder may be angled 45° around the y axis. I now need to connect these bases with straight lines to render a cylinder. For example:
begin{tikzpicture}
begin{scope}[x={(0.866cm,-0.5cm)}, z = {(-0.866cm, -0.5cm)}] %isometric
%coordinate system
draw[color = red] (0, 0, 0) -- ++(0, 0, 1);
draw[color = blue] (0, 0, 0) -- ++(0, 1, 0);
draw (0, 0, 0) -- ++(1, 0, 0);
%Useful Parameters
pgfmathsetmacro{radff}{0.2/sqrt(2)}
draw (-2,0,-2) circle[x = {(1, 0, 0)}, y = {(0, 1, 0)}, radius=0.2];
draw[dashed] (-2,0,0) circle[x = {(1, 0, 0)}, y = {(0, 1, 0)}, radius=0.2];
draw (-2+radff, -radff, -2) -- ++(0, 0, 3.8);
draw (-2-radff, +radff, -2) -- ++(0, 0, 4.2);
draw (-2,0,+2) circle[x = {(1, 0, -1)}, y = {(0, 1, 0)}, radius=0.2];
end{scope}
end{tikzpicture}
Now when I switch to a flat view this obviously does not work.
begin{scope}[x={(0cm,0cm)}, z = {(1cm, 0cm)}] %left
...
end{scope}
The circles here are rendered correctly, however the connections do not work.
Is there a good way to calculate the angle or the offset of the starting point of those connecting lines in 3d space? Additionally I need to calculate the change in length of those connections.
Unfortunately I have rather poor spacial comprehension and have trouble visualizing the lengths and angles I need to calculate. Answers contain ing an implementation using pgfmath would be greatly appreciated.
1