Sign up ×
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.

Is there an elegant way to rotate this shape about the axis and draw in 3D? Ideally I would like to be able to draw a revolved view of this as 180 deg, 270 deg and the full revolution at 360 deg.

enter image description here


\def \scalex {0.02};
\def \scaley {0.02};

%Input Variables
\def \DA {1000};
\def \EL {200};
\def \TM {20};
\def \HA {25};
\def \HI {60};
\def \DN {500};
\def \DS {325};
\def \BN {100};
\def \N {-4.026};
\def \S {1.342 };

%Draw shell
\draw (-\HA/2*\scalex, \DA/2*\scaley - \TM*\scaley) -- (-\EL /2*\scalex, \DA/2*\scaley -     \TM*\scaley) --  (-\EL /2*\scalex, \DA/2*\scaley)  --  (\EL /2*\scalex, \DA/2*\scaley) -- (\EL /2*\scalex, \DA/2*\scaley - \TM*\scaley) -- (\HA/2*\scalex, \DA/2*\scaley - \TM*\scaley); 

% Draw hub
\draw (-\HI/2*\scalex, \DN/2*\scaley) --  (-\BN/2*\scalex, \DN/2*\scaley) -- (-\BN/2*\scalex, \DS/2*\scaley) -- (\BN/2*\scalex, \DS/2*\scaley) -- (\BN/2*\scalex, \DN/2*\scaley) -- (\HI/2*\scalex, \DN/2*\scaley) ;

% Draw disk
\draw[scale=0.02,domain=\DN/2:\DA/2 - \TM, variable=\r, black ] plot ({-\HA/2*(( \r/ (\DA/2 - \TM))^(-\N/3))}, {\r} );
\draw[scale=0.02,domain=\DN/2:\DA/2 - \TM, variable=\r, black ] plot ({\HA/2*(( \r/ (\DA/2 - \TM))^(-\N/3))}, {\r} );

% Draw centerline
\draw (-2,0) -- (2,0);

% Draw labels
\draw (-\HA/2*\scalex, \DA/2*\scaley - \TM*\scaley) -- ++ (-1,-1) node [left] {a};
\draw (\HA/2*\scalex, \DA/2*\scaley - \TM*\scaley) -- ++ (1,-1) node [right] {b};
\draw (-\HI/2*\scalex, \DN/2*\scaley)  -- ++ (-1, 1) node [left] {c};
\draw (\HI/2*\scalex, \DN/2*\scaley)  -- ++ ( 1, 1) node [right] {d};

share|improve this question
These type of tasks are really for Asymptote :) – percusse Jul 30 '14 at 20:00
Welcome to TeX.SX! – Papiro Jul 30 '14 at 20:00
\usepackage{tikz-3dplot} may works ... as long as you can rewrite your contour using a function. – Symbol 1 Aug 25 '14 at 13:02
As far as I know there is a separate scripting language called sketch4latex that seems to be very powerful for 3D pictures. It compiles a sketch file to generate TikZ code, which is then processed by LaTeX. Unfortunately I can't tell you more about sketch since I have never used it before. – Simon M. Laube May 16 at 13:38
Your code does not give the figure you say it does. (You've switched the numerator and denominator in the function.) – Charles Staats May 28 at 3:16

2 Answers 2

Here's an Asymptote solution (somewhat imperfect; the inside surface could be constructed more precisely, for a slightly better result). The construction of surfaces of revolution is explained in my tutorial.

hollow surface of revolution

import graph3;

currentprojection = orthographic((10,4,2), showtarget=false);

real DA = 1000;
real EL = 200;
real TM = 20;
real HA = 25;
real HI = 60;
real DN = 500;
real DS = 325;
real BN = 100;
real N = -4.026;
real S = 1.342;

// Construct shell (right side only)
path shell = (0, DA/2) -- (EL/2, DA/2) -- (EL/2, DA/2 - TM) -- (HA/2, DA/2 - TM);

// Construct hub (right side only)
path hub = (0, DS/2) -- (BN/2, DS/2) -- (BN/2, DN/2) -- (HI/2, DN/2);

// Construct disk (right side only)
path disk = graph(new pair(real r) { return (HA/2*(( (DA/2 - TM) / r)^(-N/3)), r); },
          DN/2, DA/2-TM);

// Put them together. The shell has to be reversed so that it goes
// from bottom to top.
path wholepath = hub & disk & reverse(shell);

// Now, construct the "inside" surface (so that it can be a different color).
pair inside(real l) {
  real t = arctime(wholepath, l);
  pair offset = scale(1.0) * rotate(90) * dir(wholepath, t);
  return point(wholepath, t) + offset;
path insidepath = graph(inside, 0, arclength(wholepath), n=200);

// Put it in the YZ plane.
path3 wholepath3 = path3(wholepath, YZplane);
path3 insidepath3 = path3(insidepath, YZplane);

// Revolve the path from 0 degrees to 270 degrees.
surface revolution = surface(wholepath3, c=(0,0,0), axis=Z, angle1=0, angle2=270);
surface insidesurface = surface(insidepath3, c=(0,0,0), axis=Z, angle1=0, angle2=270);

// And now draw it.
draw(revolution, surfacepen=blue);
draw(insidesurface, surfacepen=white);
share|improve this answer
When he said "the axis" I thought it meant a different axis, namely the line at the bottom of the figure he provided, not "its axis" as in your interpretation. Nice drawing though. – Joe Corneli May 28 at 8:45
You may well be right. Hopefully the OP will clarify. – Charles Staats May 28 at 15:47 is good at rotating arbitrary shapes. It can generate TikZ code.

Here's a snippet from the manual for drawing a helix:

  % define a "polyline", in this case a single vector literal
  def K [0,0,1]
  sweep[cull=false] {
    % trace out 60 segments
    % rotating each of the segments
    % ... note, however, for your use case you would need
    % to rotate around a different point
    rotate(10, (0,0,0), [K]) then translate(1/6 * [K]) 
    % ... and you don't need the translate step
  } line[linewidth=2pt](-1,0)(1,0)

The Hello World example shows how to draw a line: line(-1,-1,-1)(2,2,2) (you can add more points to the list). It also shows how to compile the file: sketch -o simple.tex. Add global { language tikz } to your file to produce TikZ output.

This isn't a complete solution to your problem but I suspect it will point you in the right direction if you want to use Sketch.

One caveat is that curves are not implemented in the current version of Sketch, so you would have to approximate the curvature of your curved segments using a number of shorter line segments.

share|improve this answer
I think at the moment this is more of a comment than an answer. Could you maybe include an example showing how to rotate a shape like the one in the question? – Jake May 26 at 16:31
Have a look in the manual – Joe Corneli May 27 at 16:42
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Jesse May 27 at 16:55
I added more detail. I think it is enough to point the OP in the right direction. If someone wants to add another answer with more detail or a different method, please go ahead. – Joe Corneli May 27 at 17:41

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.