Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
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 at 6:01
    
Hi :) But this didn't help :( –  Bogdan Jan 30 at 6:05
1  
Ah I forgot, fix the PlotRange otherwise it will adjust and make an illusion. PlotRange->2 for example. –  Kuba Jan 30 at 6:07
add comment

1 Answer 1

up vote 4 down vote accepted

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:

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}]

enter image description here

share|improve this answer
    
@Mr.Wizard Thanks for antialiasing ;) –  Kuba Jan 30 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 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. –  Pickett Jan 30 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 at 9:36
add comment

Your Answer

 
discard

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.