<div dir="ltr">Hello,<br><br>I wonder if someone has a solution to the following problem that i have:<br>I have a very large number of non-convex polygons (70000) and i want to<br>extrude each one of them. The procedure that i follow is this:<br>vtkPoints, vtkPolygon, vtkPolyData, vtkTriangleFilter,<br>vtkLinearExtrusionFilter and add invtkAppendPolyData<br>After the extrusion of all of them:<br> vtkPolyDataMapper and i apply the Actor and put them in Renderer<br><br>Here is the code<br><br>////////////////////////////////////////////////////////////<br>       vtkSmartPointer<vtkAppendPolyData> appendFilter =<br>vtkSmartPointer<vtkAppendPolyData>::New();<br>       ////////////////////////////////////////////////////////////<br>       for (int i = 0; i < numbeams; i++) { // numcolumns<br>              ////////////////////////////////////////////////////////////<br>              // Setup four points<br>              vtkSmartPointer<vtkPoints> points =<br>vtkSmartPointer<vtkPoints>::New();<br>              for (int j = num_kop_draw_from; j < num_kop_draw_to; j++) {<br>                     points->InsertNextPoint(profile_points[j].x,<br>-profile_points[j].z, profile_points[j].y);<br>              }<br>              int NumberofIds = points->GetNumberOfPoints();<br><br>////////////////////////////////////////////////////////////////////////////<br>////////////////////<br>              vtkSmartPointer<vtkFloatArray> line_Attrib =<br>vtkSmartPointer<vtkFloatArray>::New();<br>              line_Attrib->SetNumberOfComponents(2);  // 0=color , 1=ID<br>              // Create the polygon<br>              vtkSmartPointer<vtkPolygon> polygon =<br>vtkSmartPointer<vtkPolygon>::New();<br>              polygon->GetPointIds()->SetNumberOfIds(NumberofIds); //make a<br>quad<br>              for (int ip = 0; ip < NumberofIds; ip++) {<br>                     polygon->GetPointIds()->SetId(ip, ip);<br>                     line_Attrib->InsertNextTuple2(2, id);<br>              }<br>              // Add the polygon to a list of polygons<br>              vtkSmartPointer<vtkCellArray> polygons =<br>vtkSmartPointer<vtkCellArray>::New();<br>              polygons->InsertNextCell(polygon);<br>              // Create a PolyData<br>              vtkSmartPointer<vtkPolyData> polygonPolyData =<br>vtkSmartPointer<vtkPolyData>::New();<br>              polygonPolyData->SetPoints(points);<br>              polygonPolyData->SetPolys(polygons);<br>              polygonPolyData->GetCellData()->SetScalars(line_Attrib);<br>              vtkSmartPointer<vtkTriangleFilter> triFilter =<br>vtkSmartPointer<vtkTriangleFilter>::New();<br>              triFilter->PassLinesOff();<br>              triFilter->PassVertsOff();<br>              triFilter->SetInputData(polygonPolyData);<br>              triFilter->Update();<br>              vtkSmartPointer<vtkLinearExtrusionFilter> extrudeFilter =<br>vtkSmartPointer<vtkLinearExtrusionFilter>::New();<br>              extrudeFilter->SetInputData(triFilter->GetOutput());<br>//extruding base<br>              extrudeFilter->SetExtrusionType(VTK_VECTOR_EXTRUSION);<br>              extrudeFilter->SetVector(Vector_Math[0], Vector_Math[1],<br>Vector_Math[2]); //direction<br>              extrudeFilter->SetScaleFactor(Len);<br>              extrudeFilter->Update();<br>              appendFilter->AddInputData(extrudeFilter->GetOutput());<br>              ////////////////////////////////////////////////////////////<br>}<br>       appendFilter->Update();<br>       // Create a mapper and actor<br>       vtkSmartPointer<vtkPolyDataMapper> mapper =<br>vtkSmartPointer<vtkPolyDataMapper>::New();<br>       mapper->SetInputData(appendFilter->GetOutput());<br>       if (CGI_View) {<br>              mapper->ScalarVisibilityOn();<br>              mapper->SetScalarRange(0,<br>CGI_View->colors_Palete_scada->GetNumberOfColors() - 1);<br>              mapper->SetLookupTable(CGI_View->colors_Palete_scada);<br>       }<br>       vtkSmartPointer<CGIScadaActor> actor =<br>vtkSmartPointer<CGIScadaActor>::New();<br>       actor->SetMapper(mapper);<br><br>Although the final result is pretty fast, the initial creation of the<br>objects with the previous procedure is very slow. Do you have any ideas how<br>to speed up this procedure?<br><br>Thank in advanced  <div class="gmail-yj6qo"></div><br class="gmail-Apple-interchange-newline"></div>