5
$\begingroup$

What is the practical difference between plotting Tubes and Cylinders?

The documentation for each describe a 3D tube/cylinder around the line between 2 points....they seem identical.

However, there is clearly a difference as I notice that

C1 = Cylinder[{h1, hc}, .5]
RD1 = RegionDifference[T1, C1];

works great, but

C1 = Tube[{h1, hc}, .5]
RD1 = RegionDifference[T1, C1];

spits back an error that Tube[...] is not a correctly specified region.

When should I use one or the other?

$\endgroup$

2 Answers 2

10
$\begingroup$

There are lots of places where you can indeed replace Cylinder by Tube, but Tube allows more styling options and flexibility. Most of this information can be collected from the documentation, so I'll just list some aspects that I think are especially noteworthy:

  • In terms of regions, it seems to me that you already answered the question: you can't use Tube there, as the error message says.
  • Tube supports VertexColors and Cylinder doesn't.
  • Cylinder has a fixed radius, and Tube allows a variable radius so you can make non-cylindrical shapes with it.
  • You can also use Tube with a single argument as a PlotStyle option in ParametricPlot3D.
  • Tube can extend across more than two points, and even along a curve.
$\endgroup$
4
$\begingroup$

You can't make worms with a cylinder ... but a Tube:

Graphics3D[
 Tube[BSplineCurve[{{1, 1, -1}, {2, 2, 1}, {3, 3, -1}, {3, 4, 1}}], .5]]

enter image description here

Tube takes a Line or curve to build itself around, or two endpoints. It also generates caps in a different way.

$\endgroup$
2
  • 1
    $\begingroup$ Tube may work well in the presentation world, but Cylinder with mesh is the 3D world, A good tut is some from the Blender series, I have it my self. Tough learning curve but once you learn to think 3D the rest is cake.......sort of $\endgroup$
    – Bob Brooks
    Commented May 29, 2015 at 5:45
  • $\begingroup$ See also mathematica.stackexchange.com/questions/21685/… $\endgroup$
    – Bob Brooks
    Commented May 29, 2015 at 5:48

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.