简体   繁体   English

如何在vtk中获取构成某个形状的所有点

[英]How to get all points that make up a certain shape in vtk

I am working in my graduation project and one of the tasks I am required to draw a 3D shape(for example an ellipsoid using vtkSampleFunction), this represents the heart for example.我正在做我的毕业设计,其中一项任务是绘制 3D 形状(例如使用 vtkSampleFunction 的椭圆体),这例如代表心脏。 I need to change the color of certain areas in that shape and make color gradients using 2 colors for example.我需要更改该形状中某些区域的颜色,例如使用 2 种颜色制作颜色渐变。 How can this be achieved?如何实现? All I could find is that cant be done without having polydata(points) and I dont know how to access specific points on the outline of my shape.我所能找到的只是没有 polydata(points) 就无法完成,而且我不知道如何访问形状轮廓上的特定点。 Any help would be appreciated任何帮助,将不胜感激

I tried millions of ways to access points on the outline of my shape but I cant find anyway to do it.我尝试了数百万种方法来访问我形状轮廓上的点,但无论如何我都找不到这样做。 I am new to VTK so please try to simply any answer.我是 VTK 的新手,所以请尝试简单地回答任何问题。 Thank You谢谢你

If you are looking for a way to extract all the points inside a surface, you can use the vtkSelectEnclosedPoints method.如果您正在寻找一种方法来提取表面内的所有点,您可以使用vtkSelectEnclosedPoints方法。 For example, if you want to find out which all points in pointsPolydata lie inside the surface surfacePolydata , you can use the below example.例如,如果你想找出surfacePolydata pointsPolydata ,你可以使用下面的例子。

select = vtkSelectEnclosedPoints()
select.CheckSurfaceOn ()
select.SetTolerance(0.001)
select.SetInputData(pointsPolydata)
select.SetSurfaceData(surfacePolydata)
select.Update()
outPut=select.GetOutput()

The outPut polydata will have an array named "SelectedPoints" , with 0 for point outside the surface and 1 for points inside the surface. outPut多数据将有一个名为"SelectedPoints"的数组,其中 0 表示曲面外的点,1 表示曲面内的点。

For more details, refer vtkSelectEnclosedPoints有关详细信息,请参阅vtkSelectEnclosedPoints

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM