the problem is following: my task is to make an animation: tube changes its radius but doesn't change its height. With command

Animate[Graphics3D[{CapForm["Square"], Tube[{{0, 0, 0}, {0.5, 0.5, 0.5}}, r]}], 
        {r, 10^(-9), 1}, AnimationRunning -> False]`

It changes both radius and length. How to make the fixed length?

  • $\begingroup$ Cap is expanding too. Use CapForm[None]. You can use Cylinder too and don't worry about CapForm. And hi, welcome to Mathematica SE. :) $\endgroup$
    – Kuba
    Jan 30, 2014 at 6:01
  • $\begingroup$ Hi :) But this didn't help :( $\endgroup$
    – Bogdan
    Jan 30, 2014 at 6:05
  • 1
    $\begingroup$ Ah I forgot, fix the PlotRange otherwise it will adjust and make an illusion. PlotRange->2 for example. $\endgroup$
    – Kuba
    Jan 30, 2014 at 6:07

1 Answer 1


So the answer is:

  • Fix PlotRange otherwise box will be scaled to fit the Tube and it creates an illusion of changing height.

enter image description here

  • Use different CapForm because "Square" creates excess (edit) which is proportional to the radius of basis! (Thanks @Nasser)

Well, not obvious but seems logical, "square" referrs to that.

enter image description here

Take a look here:

                     Tube[{{0, 0, 0}, {0, 0, 2}}, 1],
  CapForm["Square"], Tube[{{2, 2, 0}, {2, 2, 2}}, 1],
  CapForm[None],     Tube[{{4, 4, 0}, {4, 4, 2}}, 1],
  CapForm["Butt"],   Tube[{{6, 6, 0}, {6, 6, 2}}, 1],
                     Cylinder[{{8, 8, 0}, {8, 8, 2}}, 1]
  }, Axes -> {0, 0, 1}]

enter image description here

  • $\begingroup$ @Mr.Wizard Thanks for antialiasing ;) $\endgroup$
    – Kuba
    Jan 30, 2014 at 8:00
  • $\begingroup$ Ah, so that is why I could not make it work with PlotRange, I was using CapForm["Square"] as posted. So, with CapForm["Square"] there is no solution? Is this then a bug? or a feature? $\endgroup$
    – Nasser
    Jan 30, 2014 at 9:30
  • $\begingroup$ @Nasser This is absolutely a feature and is how it is described in the docs. I was looking at this question earlier but ultimately did not answer it because to really answer the question you have to write a function that decreases the distance between the points as the radius grows. But this seems to be all that was required to fix the OP's problem so all's good I suppose.I thought he required that capform since he has specified it. $\endgroup$
    – C. E.
    Jan 30, 2014 at 9:33
  • $\begingroup$ @Nasser and Pickett oh I've missed that. Well use "Butt", it is not obvious that Square will show such behaviour but it seems logical that then it's cap height is scaled proportionally to radius. $\endgroup$
    – Kuba
    Jan 30, 2014 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.