I’d like to generate a solid surface on vtk but when I enter the following code ctrl_points, color_points = get_data()
surface_polydata = vtk.vtkPolyData()
surface_points = vtk.vtkPoints()
surface_cells = vtk.vtkCellArray()
color_scalars = vtk.vtkUnsignedCharArray()
color_scalars.SetNumberOfComponents(4)
for i, point in enumerate(ctrl_points):
surface_points.InsertNextPoint(point)
color_scalars.InsertNextTuple4(color_points[i * 4], color_points[i * 4 + 1], color_points[i * 4 + 2], color_points[i * 4 + 3])
surface_polydata.SetPoints(surface_points)
surface_polydata.GetPointData().SetScalars(color_scalars)
bezier_surface = vtk.vtkCellArray()
bezier_surface.InsertNextCell(len(ctrl_points))
for i in range(len(ctrl_points)):
bezier_surface.InsertCellPoint(i)
surface_polydata.SetVerts(bezier_surface) I only get a visual rendering with points, my surface is not filled. Can you help me solve this problem?my get_data() function extracts data from a file and returns control points and point colors.I’d like to have a filled surface, not just the control points that appear on the screen when my programme is launched.
Thanks you for your feedback.