# Animation of tube with fixed height

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?

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

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

• 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.

Take a look here:

Graphics3D[{
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}]


-
@Mr.Wizard Thanks for antialiasing ;) – Kuba Jan 30 '14 at 8:00
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? – Nasser Jan 30 '14 at 9:30
@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. – C. E. Jan 30 '14 at 9:33
@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. – Kuba Jan 30 '14 at 9:36