VTK:在每个模拟时间步更新渲染窗口中的数据点 [英] VTK: update data points in renderWindow at every simulation timestep

查看:36
本文介绍了VTK:在每个模拟时间步更新渲染窗口中的数据点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个模拟应用程序,它在每个时间步输出一些 vtk 点数据,我想在每个时间步渲染这些数据并保持交互.

There is a simulation application which outputs some vtk point data every timestep and I would like to render this data at every timestep and also keep it interactive.

我创建了一个管道,它将模拟点 (points->SetInputData(data)) 作为输入并对其应用一组过滤器.为了测试,我创建了一个简单的计时器并添加了一个对计时器事件做出反应的观察者:

I have created a pipeline which takes simulation points (points->SetInputData(data)) as an input and applies a set of filters to it. For the sake of testing I've created a simple timer and added an observer reacting on the timer event:

  renderWindowInteractor->AddObserver(vtkCommand::TimerEvent, cb);
  int timerId = renderWindowInteractor->CreateRepeatingTimer(1000);

这就像我想要的那样工作.剩下的唯一问题是添加自定义用户事件.基本上我想在每个模拟时间步长结束时触发一些事件并在渲染窗口中更新模型.我看到了一些 VTK 示例,但我仍然不知道如何为我的案例做到这一点.有人可以帮忙吗?

This works just as I want it. The only problem left is to add a custom user event. Basically I want to trigger some event at the end of each simulation timestep and update the model in the render window. I saw some of the VTK examples but I still don't get how to do this for my case. Could anyone help?

推荐答案

如果您使用连接到过滤器的 SetInputConnection 连接可视化管道,那么您所要做的就是定期在渲染窗口上调用 Render().

If you connect the visualization pipeline using SetInputConnection connected to the filter, then all you have to do is call Render() on the render window periodically.

这篇关于VTK:在每个模拟时间步更新渲染窗口中的数据点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆