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. I need to change the color of certain areas in that shape and make color gradients using 2 colors for example. 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. 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. Thank You
If you are looking for a way to extract all the points inside a surface, you can use the vtkSelectEnclosedPoints
method. For example, if you want to find out which all points in pointsPolydata
lie inside the surface surfacePolydata
, you can use the below example.
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.
For more details, refer vtkSelectEnclosedPoints
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.