<div>I am trying to display to create and display a polyhedron and a clipped polyhedron by a plane. Does anyone know of a simple example?</div><div><br></div><div>Also, I don't understand why I have to add the vtkPolyhedron to a vtkUnstructuredGrid to display the polyhedron.</div>
<div><br></div><div>Is this the best way to display a polyhedron?</div><div><br></div><div> // Geometry</div><div><br></div><div> VTK_CREATE(vtkPoints, points);</div><div> points->InsertNextPoint(0.0, 0.0, 0.0);</div>
<div> points->InsertNextPoint(1.0, 0.0, 0.0);</div><div> points->InsertNextPoint(1.0, 1.0, 0.0);</div><div> points->InsertNextPoint(0.0, 1.0, 0.0);</div><div> points->InsertNextPoint(0.0, 0.0, 1.0);</div><div>
points->InsertNextPoint(1.0, 0.0, 1.0);</div><div> points->InsertNextPoint(1.0, 1.0, 1.0);</div><div> points->InsertNextPoint(0.0, 1.0, 1.0);</div><div><br></div><div> /*</div><div> VTK_CREATE(vtkPolyhedron, polyhedron);</div>
<div> polyhedron->GetPointIds()->SetNumberOfIds(8);</div><div> polyhedron->GetPointIds()->SetId(0,0);</div><div> polyhedron->GetPointIds()->SetId(1,1);</div><div> polyhedron->GetPointIds()->SetId(2,2);</div>
<div> polyhedron->GetPointIds()->SetId(3,3);</div><div> polyhedron->GetPointIds()->SetId(4,4);</div><div> polyhedron->GetPointIds()->SetId(5,5);</div><div> polyhedron->GetPointIds()->SetId(6,6);</div>
<div> polyhedron->GetPointIds()->SetId(7,7); </div><div> */</div><div><br></div><div> vtkIdType polyhedronPointsIds[8] = {0, 1, 2, 3, 4, 5, 6, 7};</div><div> </div><div> vtkIdType polyhedronFace[6][4] = {{0, 3, 2, 1}, {4, 5, 6, 7}, </div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                                        </span>{1, 2, 6, 5}, {0, 4, 7, 3}, </div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span> {0, 1, 5, 4}, {2, 3, 7, 6}};</div>
<div> </div><div> VTK_CREATE(vtkCellArray, polyhedronFaces); </div><div> for (int i = 0; i < 6; i++)</div><div> {</div><div> polyhedronFaces->InsertNextCell(4, polyhedronFace[i]);</div><div> }</div><div><br></div>
<div> VTK_CREATE(vtkUnstructuredGrid, uGrid); </div><div> uGrid->SetPoints(points);</div><div> uGrid->InsertNextCell(VTK_POLYHEDRON, 8, polyhedronPointsIds, 6, polyhedronFaces->GetPointer());</div><div><br></div>
<div><br></div>