Modeling a curved tube following path

Hello.

I would like to model a tube following a path like plot3D(xv, yv, zv, tube_radius = r) of matplotlib.

I wonder is there any way to model a curved tube following a position vector ?

Thank you very much for your help in advance.

Something like this?

Yes exactly ! Is there any function to model like this ?

Take examples/basic/B1 from Geant4 sources and replace there DetectorConstruction.cc with the file in the attachment. The CreateCutTubsChain(...) function does what you need.

DetectorConstruction.cc (5.5 KB)

1 Like

Very cool! So you create the “spiral” as a series of straight G4Tubs segments with the ends “beveled” to mostly match without overlap. I notice in Construct() that you place them as separate sibling volumes.

Would it make sense to integrate the segments into a G4MultiUnion solid? I think the two vectors of segments and transforms should be sufficient for that, but it’s not obvious to me what the cost/benefit tradeoff is.

We had a similar problem in CDMS, but we were dealing with curved segments (G4Torus, I think). That method made matching the end faces better, but it’s still not trivial.

Brilliant ! It works very well.

Thank you very much !

Usually I recommend to use Boolean solids only when really necessary. In case of a long “spiral”, like DNA, I believe that a set of separate G4CutTubs will perform better than G4MultiUnion solid. The segments can be moved all together by grouping them into G4AssemblyVolume.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.