Creating a Tube

Hi All,

I’m looking to make a 3D tube, essentially just a cylinder without a top or bottom. I’ve been looking for a while and it doesn’t seem like there is any simple way to do this. The cylinder type doesn’t support removal of the top or bottom, and it doesn’t look like a polygon (which does have this feature) can support the curved edges necessary to make a tube. The polyline volume geometry similarly doesn’t seem to support removal of the top and bottom.

Is it possible to create a tube in Cesium? How might I go about doing that?

Thanks!

I think you might need to either write a custom geometry based on the closest geometry type (but this isn’t trivial/requires understanding some engine internals) or loading in a glTF model of a cylinder (which you could then repeatedly add to make a longer cylinder if it’s length is not known ahead of time).

What kind of project are you working on?

Hey Omar,

So I actually figured out how to do this. I made a function that gave me 360 Cartesian3 coordinates following the circumference of a circle that’s a certain radial distance from the point where I wanted to center my tube, then input those positions as wall coordinates. From there you can add similar functions to help control the min and max wall heights. It’s a bit funky, but it works!

Thanks for the help though! Appreciate you reaching out :slight_smile: Hopefully this conversation helps someone haha.

1 Like

Oh cool, that’s a neat trick! Thanks for sharing that. I think it’ll definitely be useful to others.

PolylineVolume already supports “sweeping” a 2D shape along a surface path. You can just make the shape a closed “ring”, like in this Sandcastle example.

It’s based on the original PolylineVolume demo but I had to add an extra point (zero to 360 inclusive and back again) to avoid getting a “seam” along the side.