如何得到两个结合的vtkPolyData曲面的边界
How to get the bounds of two combined vtkPolyData surfaces?
我的VTK程序在使用vtkCubeAxesActor
的坐标系中绘制vtkPolyData对象surface1
。我以以下方式定位立方体轴:
cubeAxesActor->SetBounds( surface1->GetBounds() );
我最近添加了另一个vtkPolyData对象,surface2
。有没有一种好的方法来计算这两个曲面的"总"边界?
我知道我可以这样做:
float *bounds1 = surface1->GetBounds();
float *bounds2 = surface2->GetBounds();
float *bounds_total;
bounds_total[0] = min( bounds1[0], bounds2[0] );
bounds_total[1] = max( bounds1[1], bounds2[1] );
bounds_total[2] = min( bounds1[2], bounds2[2] );
// ...
但我想有一个更好的方法使用VTK内置?
如何添加新的vtkPolyData
?通过向vtkActor添加vtkPolyDataMapper(其中包含vtkPolyData),边界将自动计算
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(10.0);
sphere->Update();
vtkPolyDataMapper *map = vtkPolyDataMapper::New();
map->SetInputData(sphere->GetOutput());
vtkActor *aSphere = vtkActor::New();
aSphere->SetMapper(map);
std::cout << aSphere->GetBounds ()[0] << " "
<< aSphere->GetBounds ()[1] << std::endl; // print : -10 10
您可以在使用vtkAppendPolyData
演员之前计算几个vtkPolyData的边界
vtkSphereSource *sphere2 = vtkSphereSource::New();
sphere2->SetRadius(10.0);
sphere2->SetCenter (15, 15, 0);
sphere2->Update();
vtkAppendPolyData *app = vtkAppendPolyData::New();
app->AddInputData (sphere->GetOutput ());
app->AddInputData (sphere2->GetOutput ());
app->Update();
std::cout << app->GetOutput()->GetBounds ()[0] << " "
<< app->GetOutput()->GetBounds ()[1] << std::endl; // prints -10 25
相关文章:
- 多态性和功能结合
- 将 Vulkan 与 SFML 结合使用?
- 将 c++ 生成器应用程序与外部 dll 结合使用
- 如何将增强MSM与增强信号结合使用?
- MS Visual Studio 解决方案结合了非托管C++项目和 C# 项目
- 函数未在作用域中声明 / 如何结合使用 header.h、header.cpp 和 main.cpp?
- 将预编译的 C 共享库与 JNI/NDK 结合使用
- C++ 将函数指针与最佳性能相结合
- 如何将 vtkpolydata 转换为 vtkimagedata?
- 将 Lua 与 C++ DLL 结合使用
- 为什么push_back和emplace_back结合在一起时,会有不同的行为
- 将 aws-iot-device-sdk-cpp-v2 与 CMake 结合使用
- 将2个欧拉角与GLM相结合的问题
- 结合std::execution和OpenMP是否可取
- 抽象和派生与std::list相结合
- 想要将 CGAL 与四元数相结合是否合乎逻辑
- 存储/传递 v8 承诺解析器供以后使用的最佳实践?(结合C++线程)
- 如何将 IAudioClient3 (WASAPI) 与实时工作队列 API 结合使用
- 可变参数模板与默认模板参数相结合
- 如何得到两个结合的vtkPolyData曲面的边界