Tubegenerator with varying diameter


#1

I’m using Tubegenerator to draw curved tubes and I’m looking to vary the width along the path, based on the HTC Vive trigger value. Not entirely sure what is the best approach here, modify the class, using a modifier, selecting the newest ring and growing/shrinking it, or maybe something else entirely.

Some pointers would be much appreciated.


#2

Hi jilt, I think you will need to start with TubeGenerator and then modify it to be able to do this. Currently none of the mesh generators are incremental, ie you can’t add a little bit without regenerating the entire thing. A simple hack would be to add a scaling function/array/etc you could use within the outer loop of the TubeGenerator.Generate() function - essentially create a scaled copy of Polygon.Vertices each iteration (or fill a pre-allocated array, etc, etc)

you could also look at the VerticalGeneralizedCylinderGenerator class, this one uses an array of cross-section objects, but is only along a line, not a 3D path.