# How to draw a curved cuboid? [closed]

Sorry for boring you. After reading some answers in TEX stack exchange, it poses no problem to draw a regular cuboid. But, I am wandering someone knows how to draw a curved 'cuboid' as shown in the following fig (in red window). Thank you very much for taking a look.

• What have you tried? Please add a minimal working example (MWE) to your question. Apr 27, 2018 at 9:45
• Serious 3D drawing needs something like Asymptote or a proper CAD system.. Apr 27, 2018 at 11:26
• Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. Apr 28, 2018 at 1:54
• This should not be closed yet. Please wait at least 24 hours after asking the OP for improvements to the question before voting to close. Also, if you downvote, please don't forget to revert the vote after the question is improved. Apr 28, 2018 at 1:57

TikZ offers support for 3D coordinates in cartesian (and per example in the manual, cylindrical) coordinates and allows to create your own coordinate system with relative ease. In this question, a spherical coordinate system was implemented, including showing ways of drawing lines and (pseudo-) 3D effects. If you intent to draw your picture, consider a proper coordinate system, set up the projection thereof onto the 2D canvas (can't find the command in the manual right now, but is possible) and then start drawing. For a free-form, it probably best to parse a series of coordinates to a plot operation (can be read from file). If you can describe your points through a mathematical function, consider drawing them with a foreach operation, give them node names and then use line to operations to join up the nodes.

Overall, it is probably better/easier to just parse your image in a svg editor like inkscape and import the svg to tikz. (Inkscape also offers limited LaTeX math support and proper scaling thereof.)

However, given that you already have an image ready, why not just use that? It is accepted practice to put pictures from other programs into articles, books and other documents. No need to spend >6h day drawing coordinates in TeX or >1h redrawing the image in an editor. (Mileage may vary)

It is fairly straightforward to draw something of this sort, but you'll have to draw additional features in the right order, or to switch to asymptote.

\documentclass[border=2mm,tikz]{standalone}
\usepackage{tikz-3dplot}

\begin{document}

\tdplotsetmaincoords{70}{50}
\begin{tikzpicture}[tdplot_main_coords,font=\sffamily]
% Uncomment these lines if you want to know where x, y and z point to
% \draw[-latex] (-7.5,0,0) -- (7.5,0,0)  node[above right]  {$x$};
% \draw[-latex] (0,-7.5,0) -- (0,7.5,0)  node[below] {$y$};
% \draw[-latex] (0,0,-7.5) -- (0,0,7.5)  node[above left]  {$z$};
\tdplotsetrotatedcoords{90}{90}{90}
\begin{scope}[tdplot_rotated_coords]
% Uncomment these lines if you want to know where x', y' and z' point to
% \draw[-latex,blue] (-7.5,0,0) -- (7.5,0,0)  node[above right]  {$x'$};
% \draw[-latex,blue] (0,-7.5,0) -- (0,7.5,0)  node[below] {$y'$};
% \draw[-latex,blue] (0,0,-7.5) -- (0,0,7.5)  node[above left]  {$z'$};
\draw[thick,fill=gray!10] plot[variable=\x,domain={-6:6},samples=120]
({\x},{4+0.25*\x-0.6*exp(\x-6)},-1) --
plot[variable=\x,domain={6:-6},samples=120]
({\x},{4+0.25*\x-0.6*exp(\x-6)},1) -- cycle;
\draw[thick,fill=gray!30] (-6,2.5,-1) -- (-6,2.5,1) -- (-5.5,0.5,1)
--(-5.5,0.5,-1) -- cycle;
\draw[thick,fill=gray!20] plot[variable=\x,domain={-6:6},samples=120]
({\x},{4+0.25*\x-0.6*exp(\x-6)},-1) --
plot[variable=\x,domain={6:-6},samples=120]
({(5.5/6)*\x},{2+0.25*\x-0.6*exp((5.5/6)*\x-6)},-1) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}