///<summary> A Set Method for Static Variables </summary> public static void SetworldPicker(vtkWorldPointPicker toSet) { worldPicker = toSet; }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVpickCells(String [] argv) { //Prefix Content is: "" ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // create a scene with one of each cell type[] // Voxel[] voxelPoints = new vtkPoints(); voxelPoints.SetNumberOfPoints((int)8); voxelPoints.InsertPoint((int)0,(double)0,(double)0,(double)0); voxelPoints.InsertPoint((int)1,(double)1,(double)0,(double)0); voxelPoints.InsertPoint((int)2,(double)0,(double)1,(double)0); voxelPoints.InsertPoint((int)3,(double)1,(double)1,(double)0); voxelPoints.InsertPoint((int)4,(double)0,(double)0,(double)1); voxelPoints.InsertPoint((int)5,(double)1,(double)0,(double)1); voxelPoints.InsertPoint((int)6,(double)0,(double)1,(double)1); voxelPoints.InsertPoint((int)7,(double)1,(double)1,(double)1); aVoxel = new vtkVoxel(); aVoxel.GetPointIds().SetId((int)0,(int)0); aVoxel.GetPointIds().SetId((int)1,(int)1); aVoxel.GetPointIds().SetId((int)2,(int)2); aVoxel.GetPointIds().SetId((int)3,(int)3); aVoxel.GetPointIds().SetId((int)4,(int)4); aVoxel.GetPointIds().SetId((int)5,(int)5); aVoxel.GetPointIds().SetId((int)6,(int)6); aVoxel.GetPointIds().SetId((int)7,(int)7); aVoxelGrid = new vtkUnstructuredGrid(); aVoxelGrid.Allocate((int)1,(int)1); aVoxelGrid.InsertNextCell((int)aVoxel.GetCellType(),(vtkIdList)aVoxel.GetPointIds()); aVoxelGrid.SetPoints((vtkPoints)voxelPoints); aVoxelMapper = new vtkDataSetMapper(); aVoxelMapper.SetInput((vtkDataSet)aVoxelGrid); aVoxelActor = new vtkActor(); aVoxelActor.SetMapper((vtkMapper)aVoxelMapper); aVoxelActor.GetProperty().BackfaceCullingOn(); // Hexahedron[] hexahedronPoints = new vtkPoints(); hexahedronPoints.SetNumberOfPoints((int)8); hexahedronPoints.InsertPoint((int)0,(double)0,(double)0,(double)0); hexahedronPoints.InsertPoint((int)1,(double)1,(double)0,(double)0); hexahedronPoints.InsertPoint((int)2,(double)1,(double)1,(double)0); hexahedronPoints.InsertPoint((int)3,(double)0,(double)1,(double)0); hexahedronPoints.InsertPoint((int)4,(double)0,(double)0,(double)1); hexahedronPoints.InsertPoint((int)5,(double)1,(double)0,(double)1); hexahedronPoints.InsertPoint((int)6,(double)1,(double)1,(double)1); hexahedronPoints.InsertPoint((int)7,(double)0,(double)1,(double)1); aHexahedron = new vtkHexahedron(); aHexahedron.GetPointIds().SetId((int)0,(int)0); aHexahedron.GetPointIds().SetId((int)1,(int)1); aHexahedron.GetPointIds().SetId((int)2,(int)2); aHexahedron.GetPointIds().SetId((int)3,(int)3); aHexahedron.GetPointIds().SetId((int)4,(int)4); aHexahedron.GetPointIds().SetId((int)5,(int)5); aHexahedron.GetPointIds().SetId((int)6,(int)6); aHexahedron.GetPointIds().SetId((int)7,(int)7); aHexahedronGrid = new vtkUnstructuredGrid(); aHexahedronGrid.Allocate((int)1,(int)1); aHexahedronGrid.InsertNextCell((int)aHexahedron.GetCellType(),(vtkIdList)aHexahedron.GetPointIds()); aHexahedronGrid.SetPoints((vtkPoints)hexahedronPoints); aHexahedronMapper = new vtkDataSetMapper(); aHexahedronMapper.SetInput((vtkDataSet)aHexahedronGrid); aHexahedronActor = new vtkActor(); aHexahedronActor.SetMapper((vtkMapper)aHexahedronMapper); aHexahedronActor.AddPosition((double)2,(double)0,(double)0); aHexahedronActor.GetProperty().BackfaceCullingOn(); // Tetra[] tetraPoints = new vtkPoints(); tetraPoints.SetNumberOfPoints((int)4); tetraPoints.InsertPoint((int)0,(double)0,(double)0,(double)0); tetraPoints.InsertPoint((int)1,(double)1,(double)0,(double)0); tetraPoints.InsertPoint((int)2,(double).5,(double)1,(double)0); tetraPoints.InsertPoint((int)3,(double).5,(double).5,(double)1); aTetra = new vtkTetra(); aTetra.GetPointIds().SetId((int)0,(int)0); aTetra.GetPointIds().SetId((int)1,(int)1); aTetra.GetPointIds().SetId((int)2,(int)2); aTetra.GetPointIds().SetId((int)3,(int)3); aTetraGrid = new vtkUnstructuredGrid(); aTetraGrid.Allocate((int)1,(int)1); aTetraGrid.InsertNextCell((int)aTetra.GetCellType(),(vtkIdList)aTetra.GetPointIds()); aTetraGrid.SetPoints((vtkPoints)tetraPoints); aTetraMapper = new vtkDataSetMapper(); aTetraMapper.SetInput((vtkDataSet)aTetraGrid); aTetraActor = new vtkActor(); aTetraActor.SetMapper((vtkMapper)aTetraMapper); aTetraActor.AddPosition((double)4,(double)0,(double)0); aTetraActor.GetProperty().BackfaceCullingOn(); // Wedge[] wedgePoints = new vtkPoints(); wedgePoints.SetNumberOfPoints((int)6); wedgePoints.InsertPoint((int)0,(double)0,(double)1,(double)0); wedgePoints.InsertPoint((int)1,(double)0,(double)0,(double)0); wedgePoints.InsertPoint((int)2,(double)0,(double).5,(double).5); wedgePoints.InsertPoint((int)3,(double)1,(double)1,(double)0); wedgePoints.InsertPoint((int)4,(double)1,(double)0,(double)0); wedgePoints.InsertPoint((int)5,(double)1,(double).5,(double).5); aWedge = new vtkWedge(); aWedge.GetPointIds().SetId((int)0,(int)0); aWedge.GetPointIds().SetId((int)1,(int)1); aWedge.GetPointIds().SetId((int)2,(int)2); aWedge.GetPointIds().SetId((int)3,(int)3); aWedge.GetPointIds().SetId((int)4,(int)4); aWedge.GetPointIds().SetId((int)5,(int)5); aWedgeGrid = new vtkUnstructuredGrid(); aWedgeGrid.Allocate((int)1,(int)1); aWedgeGrid.InsertNextCell((int)aWedge.GetCellType(),(vtkIdList)aWedge.GetPointIds()); aWedgeGrid.SetPoints((vtkPoints)wedgePoints); aWedgeMapper = new vtkDataSetMapper(); aWedgeMapper.SetInput((vtkDataSet)aWedgeGrid); aWedgeActor = new vtkActor(); aWedgeActor.SetMapper((vtkMapper)aWedgeMapper); aWedgeActor.AddPosition((double)6,(double)0,(double)0); aWedgeActor.GetProperty().BackfaceCullingOn(); // Pyramid[] pyramidPoints = new vtkPoints(); pyramidPoints.SetNumberOfPoints((int)5); pyramidPoints.InsertPoint((int)0,(double)0,(double)0,(double)0); pyramidPoints.InsertPoint((int)1,(double)1,(double)0,(double)0); pyramidPoints.InsertPoint((int)2,(double)1,(double)1,(double)0); pyramidPoints.InsertPoint((int)3,(double)0,(double)1,(double)0); pyramidPoints.InsertPoint((int)4,(double).5,(double).5,(double)1); aPyramid = new vtkPyramid(); aPyramid.GetPointIds().SetId((int)0,(int)0); aPyramid.GetPointIds().SetId((int)1,(int)1); aPyramid.GetPointIds().SetId((int)2,(int)2); aPyramid.GetPointIds().SetId((int)3,(int)3); aPyramid.GetPointIds().SetId((int)4,(int)4); aPyramidGrid = new vtkUnstructuredGrid(); aPyramidGrid.Allocate((int)1,(int)1); aPyramidGrid.InsertNextCell((int)aPyramid.GetCellType(),(vtkIdList)aPyramid.GetPointIds()); aPyramidGrid.SetPoints((vtkPoints)pyramidPoints); aPyramidMapper = new vtkDataSetMapper(); aPyramidMapper.SetInput((vtkDataSet)aPyramidGrid); aPyramidActor = new vtkActor(); aPyramidActor.SetMapper((vtkMapper)aPyramidMapper); aPyramidActor.AddPosition((double)8,(double)0,(double)0); aPyramidActor.GetProperty().BackfaceCullingOn(); // Pixel[] pixelPoints = new vtkPoints(); pixelPoints.SetNumberOfPoints((int)4); pixelPoints.InsertPoint((int)0,(double)0,(double)0,(double)0); pixelPoints.InsertPoint((int)1,(double)1,(double)0,(double)0); pixelPoints.InsertPoint((int)2,(double)0,(double)1,(double)0); pixelPoints.InsertPoint((int)3,(double)1,(double)1,(double)0); aPixel = new vtkPixel(); aPixel.GetPointIds().SetId((int)0,(int)0); aPixel.GetPointIds().SetId((int)1,(int)1); aPixel.GetPointIds().SetId((int)2,(int)2); aPixel.GetPointIds().SetId((int)3,(int)3); aPixelGrid = new vtkUnstructuredGrid(); aPixelGrid.Allocate((int)1,(int)1); aPixelGrid.InsertNextCell((int)aPixel.GetCellType(),(vtkIdList)aPixel.GetPointIds()); aPixelGrid.SetPoints((vtkPoints)pixelPoints); aPixelMapper = new vtkDataSetMapper(); aPixelMapper.SetInput((vtkDataSet)aPixelGrid); aPixelActor = new vtkActor(); aPixelActor.SetMapper((vtkMapper)aPixelMapper); aPixelActor.AddPosition((double)0,(double)0,(double)2); aPixelActor.GetProperty().BackfaceCullingOn(); // Quad[] quadPoints = new vtkPoints(); quadPoints.SetNumberOfPoints((int)4); quadPoints.InsertPoint((int)0,(double)0,(double)0,(double)0); quadPoints.InsertPoint((int)1,(double)1,(double)0,(double)0); quadPoints.InsertPoint((int)2,(double)1,(double)1,(double)0); quadPoints.InsertPoint((int)3,(double)0,(double)1,(double)0); aQuad = new vtkQuad(); aQuad.GetPointIds().SetId((int)0,(int)0); aQuad.GetPointIds().SetId((int)1,(int)1); aQuad.GetPointIds().SetId((int)2,(int)2); aQuad.GetPointIds().SetId((int)3,(int)3); aQuadGrid = new vtkUnstructuredGrid(); aQuadGrid.Allocate((int)1,(int)1); aQuadGrid.InsertNextCell((int)aQuad.GetCellType(),(vtkIdList)aQuad.GetPointIds()); aQuadGrid.SetPoints((vtkPoints)quadPoints); aQuadMapper = new vtkDataSetMapper(); aQuadMapper.SetInput((vtkDataSet)aQuadGrid); aQuadActor = new vtkActor(); aQuadActor.SetMapper((vtkMapper)aQuadMapper); aQuadActor.AddPosition((double)2,(double)0,(double)2); aQuadActor.GetProperty().BackfaceCullingOn(); // Triangle[] trianglePoints = new vtkPoints(); trianglePoints.SetNumberOfPoints((int)3); trianglePoints.InsertPoint((int)0,(double)0,(double)0,(double)0); trianglePoints.InsertPoint((int)1,(double)1,(double)0,(double)0); trianglePoints.InsertPoint((int)2,(double).5,(double).5,(double)0); aTriangle = new vtkTriangle(); aTriangle.GetPointIds().SetId((int)0,(int)0); aTriangle.GetPointIds().SetId((int)1,(int)1); aTriangle.GetPointIds().SetId((int)2,(int)2); aTriangleGrid = new vtkUnstructuredGrid(); aTriangleGrid.Allocate((int)1,(int)1); aTriangleGrid.InsertNextCell((int)aTriangle.GetCellType(),(vtkIdList)aTriangle.GetPointIds()); aTriangleGrid.SetPoints((vtkPoints)trianglePoints); aTriangleMapper = new vtkDataSetMapper(); aTriangleMapper.SetInput((vtkDataSet)aTriangleGrid); aTriangleActor = new vtkActor(); aTriangleActor.SetMapper((vtkMapper)aTriangleMapper); aTriangleActor.AddPosition((double)4,(double)0,(double)2); aTriangleActor.GetProperty().BackfaceCullingOn(); // Polygon[] polygonPoints = new vtkPoints(); polygonPoints.SetNumberOfPoints((int)4); polygonPoints.InsertPoint((int)0,(double)0,(double)0,(double)0); polygonPoints.InsertPoint((int)1,(double)1,(double)0,(double)0); polygonPoints.InsertPoint((int)2,(double)1,(double)1,(double)0); polygonPoints.InsertPoint((int)3,(double)0,(double)1,(double)0); aPolygon = new vtkPolygon(); aPolygon.GetPointIds().SetNumberOfIds((int)4); aPolygon.GetPointIds().SetId((int)0,(int)0); aPolygon.GetPointIds().SetId((int)1,(int)1); aPolygon.GetPointIds().SetId((int)2,(int)2); aPolygon.GetPointIds().SetId((int)3,(int)3); aPolygonGrid = new vtkUnstructuredGrid(); aPolygonGrid.Allocate((int)1,(int)1); aPolygonGrid.InsertNextCell((int)aPolygon.GetCellType(),(vtkIdList)aPolygon.GetPointIds()); aPolygonGrid.SetPoints((vtkPoints)polygonPoints); aPolygonMapper = new vtkDataSetMapper(); aPolygonMapper.SetInput((vtkDataSet)aPolygonGrid); aPolygonActor = new vtkActor(); aPolygonActor.SetMapper((vtkMapper)aPolygonMapper); aPolygonActor.AddPosition((double)6,(double)0,(double)2); aPolygonActor.GetProperty().BackfaceCullingOn(); // Triangle Strip[] triangleStripPoints = new vtkPoints(); triangleStripPoints.SetNumberOfPoints((int)5); triangleStripPoints.InsertPoint((int)0,(double)0,(double)1,(double)0); triangleStripPoints.InsertPoint((int)1,(double)0,(double)0,(double)0); triangleStripPoints.InsertPoint((int)2,(double)1,(double)1,(double)0); triangleStripPoints.InsertPoint((int)3,(double)1,(double)0,(double)0); triangleStripPoints.InsertPoint((int)4,(double)2,(double)1,(double)0); aTriangleStrip = new vtkTriangleStrip(); aTriangleStrip.GetPointIds().SetNumberOfIds((int)5); aTriangleStrip.GetPointIds().SetId((int)0,(int)0); aTriangleStrip.GetPointIds().SetId((int)1,(int)1); aTriangleStrip.GetPointIds().SetId((int)2,(int)2); aTriangleStrip.GetPointIds().SetId((int)3,(int)3); aTriangleStrip.GetPointIds().SetId((int)4,(int)4); aTriangleStripGrid = new vtkUnstructuredGrid(); aTriangleStripGrid.Allocate((int)1,(int)1); aTriangleStripGrid.InsertNextCell((int)aTriangleStrip.GetCellType(),(vtkIdList)aTriangleStrip.GetPointIds()); aTriangleStripGrid.SetPoints((vtkPoints)triangleStripPoints); aTriangleStripMapper = new vtkDataSetMapper(); aTriangleStripMapper.SetInput((vtkDataSet)aTriangleStripGrid); aTriangleStripActor = new vtkActor(); aTriangleStripActor.SetMapper((vtkMapper)aTriangleStripMapper); aTriangleStripActor.AddPosition((double)8,(double)0,(double)2); aTriangleStripActor.GetProperty().BackfaceCullingOn(); // Line[] linePoints = new vtkPoints(); linePoints.SetNumberOfPoints((int)2); linePoints.InsertPoint((int)0,(double)0,(double)0,(double)0); linePoints.InsertPoint((int)1,(double)1,(double)1,(double)0); aLine = new vtkLine(); aLine.GetPointIds().SetId((int)0,(int)0); aLine.GetPointIds().SetId((int)1,(int)1); aLineGrid = new vtkUnstructuredGrid(); aLineGrid.Allocate((int)1,(int)1); aLineGrid.InsertNextCell((int)aLine.GetCellType(),(vtkIdList)aLine.GetPointIds()); aLineGrid.SetPoints((vtkPoints)linePoints); aLineMapper = new vtkDataSetMapper(); aLineMapper.SetInput((vtkDataSet)aLineGrid); aLineActor = new vtkActor(); aLineActor.SetMapper((vtkMapper)aLineMapper); aLineActor.AddPosition((double)0,(double)0,(double)4); aLineActor.GetProperty().BackfaceCullingOn(); // Poly line[] polyLinePoints = new vtkPoints(); polyLinePoints.SetNumberOfPoints((int)3); polyLinePoints.InsertPoint((int)0,(double)0,(double)0,(double)0); polyLinePoints.InsertPoint((int)1,(double)1,(double)1,(double)0); polyLinePoints.InsertPoint((int)2,(double)1,(double)0,(double)0); aPolyLine = new vtkPolyLine(); aPolyLine.GetPointIds().SetNumberOfIds((int)3); aPolyLine.GetPointIds().SetId((int)0,(int)0); aPolyLine.GetPointIds().SetId((int)1,(int)1); aPolyLine.GetPointIds().SetId((int)2,(int)2); aPolyLineGrid = new vtkUnstructuredGrid(); aPolyLineGrid.Allocate((int)1,(int)1); aPolyLineGrid.InsertNextCell((int)aPolyLine.GetCellType(),(vtkIdList)aPolyLine.GetPointIds()); aPolyLineGrid.SetPoints((vtkPoints)polyLinePoints); aPolyLineMapper = new vtkDataSetMapper(); aPolyLineMapper.SetInput((vtkDataSet)aPolyLineGrid); aPolyLineActor = new vtkActor(); aPolyLineActor.SetMapper((vtkMapper)aPolyLineMapper); aPolyLineActor.AddPosition((double)2,(double)0,(double)4); aPolyLineActor.GetProperty().BackfaceCullingOn(); // Vertex[] vertexPoints = new vtkPoints(); vertexPoints.SetNumberOfPoints((int)1); vertexPoints.InsertPoint((int)0,(double)0,(double)0,(double)0); aVertex = new vtkVertex(); aVertex.GetPointIds().SetId((int)0,(int)0); aVertexGrid = new vtkUnstructuredGrid(); aVertexGrid.Allocate((int)1,(int)1); aVertexGrid.InsertNextCell((int)aVertex.GetCellType(),(vtkIdList)aVertex.GetPointIds()); aVertexGrid.SetPoints((vtkPoints)vertexPoints); aVertexMapper = new vtkDataSetMapper(); aVertexMapper.SetInput((vtkDataSet)aVertexGrid); aVertexActor = new vtkActor(); aVertexActor.SetMapper((vtkMapper)aVertexMapper); aVertexActor.AddPosition((double)0,(double)0,(double)6); aVertexActor.GetProperty().BackfaceCullingOn(); // Poly Vertex[] polyVertexPoints = new vtkPoints(); polyVertexPoints.SetNumberOfPoints((int)3); polyVertexPoints.InsertPoint((int)0,(double)0,(double)0,(double)0); polyVertexPoints.InsertPoint((int)1,(double)1,(double)0,(double)0); polyVertexPoints.InsertPoint((int)2,(double)1,(double)1,(double)0); aPolyVertex = new vtkPolyVertex(); aPolyVertex.GetPointIds().SetNumberOfIds((int)3); aPolyVertex.GetPointIds().SetId((int)0,(int)0); aPolyVertex.GetPointIds().SetId((int)1,(int)1); aPolyVertex.GetPointIds().SetId((int)2,(int)2); aPolyVertexGrid = new vtkUnstructuredGrid(); aPolyVertexGrid.Allocate((int)1,(int)1); aPolyVertexGrid.InsertNextCell((int)aPolyVertex.GetCellType(),(vtkIdList)aPolyVertex.GetPointIds()); aPolyVertexGrid.SetPoints((vtkPoints)polyVertexPoints); aPolyVertexMapper = new vtkDataSetMapper(); aPolyVertexMapper.SetInput((vtkDataSet)aPolyVertexGrid); aPolyVertexActor = new vtkActor(); aPolyVertexActor.SetMapper((vtkMapper)aPolyVertexMapper); aPolyVertexActor.AddPosition((double)2,(double)0,(double)6); aPolyVertexActor.GetProperty().BackfaceCullingOn(); // Pentagonal prism[] pentaPoints = new vtkPoints(); pentaPoints.SetNumberOfPoints((int)10); pentaPoints.InsertPoint((int)0,(double)0.25,(double)0.0,(double)0.0); pentaPoints.InsertPoint((int)1,(double)0.75,(double)0.0,(double)0.0); pentaPoints.InsertPoint((int)2,(double)1.0,(double)0.5,(double)0.0); pentaPoints.InsertPoint((int)3,(double)0.5,(double)1.0,(double)0.0); pentaPoints.InsertPoint((int)4,(double)0.0,(double)0.5,(double)0.0); pentaPoints.InsertPoint((int)5,(double)0.25,(double)0.0,(double)1.0); pentaPoints.InsertPoint((int)6,(double)0.75,(double)0.0,(double)1.0); pentaPoints.InsertPoint((int)7,(double)1.0,(double)0.5,(double)1.0); pentaPoints.InsertPoint((int)8,(double)0.5,(double)1.0,(double)1.0); pentaPoints.InsertPoint((int)9,(double)0.0,(double)0.5,(double)1.0); aPenta = new vtkPentagonalPrism(); aPenta.GetPointIds().SetId((int)0,(int)0); aPenta.GetPointIds().SetId((int)1,(int)1); aPenta.GetPointIds().SetId((int)2,(int)2); aPenta.GetPointIds().SetId((int)3,(int)3); aPenta.GetPointIds().SetId((int)4,(int)4); aPenta.GetPointIds().SetId((int)5,(int)5); aPenta.GetPointIds().SetId((int)6,(int)6); aPenta.GetPointIds().SetId((int)7,(int)7); aPenta.GetPointIds().SetId((int)8,(int)8); aPenta.GetPointIds().SetId((int)9,(int)9); aPentaGrid = new vtkUnstructuredGrid(); aPentaGrid.Allocate((int)1,(int)1); aPentaGrid.InsertNextCell((int)aPenta.GetCellType(),(vtkIdList)aPenta.GetPointIds()); aPentaGrid.SetPoints((vtkPoints)pentaPoints); aPentaMapper = new vtkDataSetMapper(); aPentaMapper.SetInput((vtkDataSet)aPentaGrid); aPentaActor = new vtkActor(); aPentaActor.SetMapper((vtkMapper)aPentaMapper); aPentaActor.AddPosition((double)10,(double)0,(double)0); aPentaActor.GetProperty().BackfaceCullingOn(); // Hexagonal prism[] hexaPoints = new vtkPoints(); hexaPoints.SetNumberOfPoints((int)12); hexaPoints.InsertPoint((int)0,(double)0.0,(double)0.0,(double)0.0); hexaPoints.InsertPoint((int)1,(double)0.5,(double)0.0,(double)0.0); hexaPoints.InsertPoint((int)2,(double)1.0,(double)0.5,(double)0.0); hexaPoints.InsertPoint((int)3,(double)1.0,(double)1.0,(double)0.0); hexaPoints.InsertPoint((int)4,(double)0.5,(double)1.0,(double)0.0); hexaPoints.InsertPoint((int)5,(double)0.0,(double)0.5,(double)0.0); hexaPoints.InsertPoint((int)6,(double)0.0,(double)0.0,(double)1.0); hexaPoints.InsertPoint((int)7,(double)0.5,(double)0.0,(double)1.0); hexaPoints.InsertPoint((int)8,(double)1.0,(double)0.5,(double)1.0); hexaPoints.InsertPoint((int)9,(double)1.0,(double)1.0,(double)1.0); hexaPoints.InsertPoint((int)10,(double)0.5,(double)1.0,(double)1.0); hexaPoints.InsertPoint((int)11,(double)0.0,(double)0.5,(double)1.0); aHexa = new vtkHexagonalPrism(); aHexa.GetPointIds().SetId((int)0,(int)0); aHexa.GetPointIds().SetId((int)1,(int)1); aHexa.GetPointIds().SetId((int)2,(int)2); aHexa.GetPointIds().SetId((int)3,(int)3); aHexa.GetPointIds().SetId((int)4,(int)4); aHexa.GetPointIds().SetId((int)5,(int)5); aHexa.GetPointIds().SetId((int)6,(int)6); aHexa.GetPointIds().SetId((int)7,(int)7); aHexa.GetPointIds().SetId((int)8,(int)8); aHexa.GetPointIds().SetId((int)9,(int)9); aHexa.GetPointIds().SetId((int)10,(int)10); aHexa.GetPointIds().SetId((int)11,(int)11); aHexaGrid = new vtkUnstructuredGrid(); aHexaGrid.Allocate((int)1,(int)1); aHexaGrid.InsertNextCell((int)aHexa.GetCellType(),(vtkIdList)aHexa.GetPointIds()); aHexaGrid.SetPoints((vtkPoints)hexaPoints); aHexaMapper = new vtkDataSetMapper(); aHexaMapper.SetInput((vtkDataSet)aHexaGrid); aHexaActor = new vtkActor(); aHexaActor.SetMapper((vtkMapper)aHexaMapper); aHexaActor.AddPosition((double)12,(double)0,(double)0); aHexaActor.GetProperty().BackfaceCullingOn(); ren1.SetBackground((double).1,(double).2,(double).4); ren1.AddActor((vtkProp)aVoxelActor); aVoxelActor.GetProperty().SetDiffuseColor((double)1,(double)0,(double)0); ren1.AddActor((vtkProp)aHexahedronActor); aHexahedronActor.GetProperty().SetDiffuseColor((double)1,(double)1,(double)0); ren1.AddActor((vtkProp)aTetraActor); aTetraActor.GetProperty().SetDiffuseColor((double)0,(double)1,(double)0); ren1.AddActor((vtkProp)aWedgeActor); aWedgeActor.GetProperty().SetDiffuseColor((double)0,(double)1,(double)1); ren1.AddActor((vtkProp)aPyramidActor); aPyramidActor.GetProperty().SetDiffuseColor((double)1,(double)0,(double)1); ren1.AddActor((vtkProp)aPixelActor); aPixelActor.GetProperty().SetDiffuseColor((double)0,(double)1,(double)1); ren1.AddActor((vtkProp)aQuadActor); aQuadActor.GetProperty().SetDiffuseColor((double)1,(double)0,(double)1); ren1.AddActor((vtkProp)aTriangleActor); aTriangleActor.GetProperty().SetDiffuseColor((double).3,(double)1,(double).5); ren1.AddActor((vtkProp)aPolygonActor); aPolygonActor.GetProperty().SetDiffuseColor((double)1,(double).4,(double).5); ren1.AddActor((vtkProp)aTriangleStripActor); aTriangleStripActor.GetProperty().SetDiffuseColor((double).3,(double).7,(double)1); ren1.AddActor((vtkProp)aLineActor); aLineActor.GetProperty().SetDiffuseColor((double).2,(double)1,(double)1); ren1.AddActor((vtkProp)aPolyLineActor); aPolyLineActor.GetProperty().SetDiffuseColor((double)1,(double)1,(double)1); ren1.AddActor((vtkProp)aVertexActor); aVertexActor.GetProperty().SetDiffuseColor((double)1,(double)1,(double)1); ren1.AddActor((vtkProp)aPolyVertexActor); aPolyVertexActor.GetProperty().SetDiffuseColor((double)1,(double)1,(double)1); ren1.AddActor((vtkProp)aPentaActor); aPentaActor.GetProperty().SetDiffuseColor((double).2,(double).4,(double).7); ren1.AddActor((vtkProp)aHexaActor); aHexaActor.GetProperty().SetDiffuseColor((double).7,(double).5,(double)1); ren1.ResetCamera(); ren1.GetActiveCamera().Azimuth((double)30); ren1.GetActiveCamera().Elevation((double)20); ren1.GetActiveCamera().Dolly((double)1.25); ren1.ResetCameraClippingRange(); renWin.Render(); cellPicker = new vtkCellPicker(); pointPicker = new vtkPointPicker(); worldPicker = new vtkWorldPointPicker(); cellCount = 0; pointCount = 0; ren1.IsInViewport((int)0,(int)0); x = 0; while((x) <= 265) { y = 100; while((y) <= 200) { cellPicker.Pick((double)x,(double)y,(double)0,(vtkRenderer)ren1); pointPicker.Pick((double)x,(double)y,(double)0,(vtkRenderer)ren1); worldPicker.Pick((double)x,(double)y,(double)0,(vtkRenderer)ren1); if ((cellPicker.GetCellId()) != -1) { cellCount = cellCount + 1; } if ((pointPicker.GetPointId()) != -1) { pointCount = pointCount + 1; } y = y + 6; } x = x + 6; } // render the image[] //[] iren.Initialize(); //deleteAllVTKObjects(); }