[vtkusers] Automate Rendering / Data Updating in VTK

M. Jordan mjordan at live.at
Fri Aug 18 16:56:03 EDT 2017


Hi guys,

I need some help for the following problem.

I have a class which describes the appearance of a cube.

class CubeInfo
{
   public:

         double* sideLength;
}

Now I am looking for a way to render a cube based on the information of a CubeInfo object automatically. Therefore, the cube should be updated
whenever data of the CubeInfo changes. The sideLength member points to a double value which changes regularly.

The set functions of the vtkCubeSource do not allow to pass pointers to it:


 vtkSmartPointer<vtkCubeSource> cubeSource =
 vtkSmartPointer<vtkCubeSource>::New();
 cubeSource->SetCenter(0.0, 0.0, 0.0);
 cubeSource->SetXLength(*sideLength);
 cubeSource->SetYLength(*sideLength);
 cubeSource->SetZLength(*sideLength);

In this case the cube is rendered with the side length value at the time of creation and will not change.
Ideally, i would like to pass the "sideLength" pointer to the cubeSource and every time the Cube is repainted (interaction or something) the cube should
change its radius according to the value the pointer is pointing to.

The only solution I found is to regularly check if the value the pointer is pointing to changes and use a callback / signal-slot mechanism which calls a function
which contains:

cubeSource->SetXLength(*sideLength);
update();

or use the "setScale" method of the corresponding actor to change the length.

Is there any mechanism in VTK which allows "streaming"/variable data inputs? Or is there any Qt / C++ workaround?

Thank you very much!



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170818/a902d7bf/attachment.html>


More information about the vtkusers mailing list