/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVTestUnstructuredPieces(String [] argv) { //Prefix Content is: "" math = new vtkMath(); vtkMath.RandomSeed((int)22); pf = new vtkParallelFactory(); vtkParallelFactory.RegisterFactory((vtkObjectFactory)pf); pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)100); dst = new vtkDataSetTriangleFilter(); dst.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); extract = new vtkExtractUnstructuredGridPiece(); extract.SetInputConnection((vtkAlgorithmOutput)dst.GetOutputPort()); cf = new vtkContourFilter(); cf.SetInputConnection((vtkAlgorithmOutput)extract.GetOutputPort()); cf.SetValue((int)0,(double)0.24); pdn = new vtkPolyDataNormals(); pdn.SetInputConnection((vtkAlgorithmOutput)cf.GetOutputPort()); ps = new vtkPieceScalars(); ps.SetInputConnection((vtkAlgorithmOutput)pdn.GetOutputPort()); mapper = vtkPolyDataMapper.New(); mapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort()); mapper.SetNumberOfPieces((int)3); actor = new vtkActor(); actor.SetMapper((vtkMapper)mapper); ren = vtkRenderer.New(); ren.AddActor((vtkProp)actor); ren.ResetCamera(); camera = ren.GetActiveCamera(); //$camera SetPosition 68.1939 -23.4323 12.6465[] //$camera SetViewUp 0.46563 0.882375 0.0678508 [] //$camera SetFocalPoint 3.65707 11.4552 1.83509 [] //$camera SetClippingRange 59.2626 101.825 [] renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); iren.Initialize(); //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVpolyConn(String [] argv) { //Prefix Content is: "" // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // read data[] //[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)100); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); // planes to connect[] plane1 = new vtkStructuredGridGeometryFilter(); plane1.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); plane1.SetExtent((int)20,(int)20,(int)0,(int)100,(int)0,(int)100); conn = new vtkPolyDataConnectivityFilter(); conn.SetInputConnection((vtkAlgorithmOutput)plane1.GetOutputPort()); conn.ScalarConnectivityOn(); conn.SetScalarRange((double)0.19,(double)0.25); plane1Map = vtkPolyDataMapper.New(); plane1Map.SetInputConnection((vtkAlgorithmOutput)conn.GetOutputPort()); plane1Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); plane1Actor = new vtkActor(); plane1Actor.SetMapper((vtkMapper)plane1Map); plane1Actor.GetProperty().SetOpacity((double)0.999); // outline[] outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineProp = outlineActor.GetProperty(); outlineProp.SetColor((double)0,(double)0,(double)0); // Add the actors to the renderer, set the background and size[] //[] ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)plane1Actor); ren1.SetBackground((double)1,(double)1,(double)1); renWin.SetSize((int)300,(int)300); cam1 = new vtkCamera(); cam1.SetClippingRange((double)14.29,(double)63.53); cam1.SetFocalPoint((double)8.58522,(double)1.58266,(double)30.6486); cam1.SetPosition((double)37.6808,(double)-20.1298,(double)35.4016); cam1.SetViewAngle((double)30); cam1.SetViewUp((double)-0.0566235,(double)0.140504,(double)0.98846); ren1.SetActiveCamera((vtkCamera)cam1); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVmergeFilter(String [] argv) { //Prefix Content is: "" // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); ren2 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); renWin.AddRenderer((vtkRenderer)ren2); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // create pipeline[] //[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)110); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); probeLine = new vtkLineSource(); probeLine.SetPoint1((double)1,(double)1,(double)29); probeLine.SetPoint2((double)16.5,(double)5,(double)31.7693); probeLine.SetResolution((int)500); probe = new vtkProbeFilter(); probe.SetInputConnection((vtkAlgorithmOutput)probeLine.GetOutputPort()); probe.SetSource((vtkDataObject)pl3d.GetOutput()); probeTube = new vtkTubeFilter(); probeTube.SetInput((vtkDataObject)probe.GetPolyDataOutput()); probeTube.SetNumberOfSides((int)5); probeTube.SetRadius((double).05); probeMapper = vtkPolyDataMapper.New(); probeMapper.SetInputConnection((vtkAlgorithmOutput)probeTube.GetOutputPort()); probeMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); probeActor = new vtkActor(); probeActor.SetMapper((vtkMapper)probeMapper); displayLine = new vtkLineSource(); displayLine.SetPoint1((double)0,(double)0,(double)0); displayLine.SetPoint2((double)1,(double)0,(double)0); displayLine.SetResolution((int)probeLine.GetResolution()); displayMerge = new vtkMergeFilter(); displayMerge.SetGeometry((vtkDataSet)displayLine.GetOutput()); displayMerge.SetScalars((vtkDataSet)probe.GetPolyDataOutput()); displayWarp = new vtkWarpScalar(); displayWarp.SetInput((vtkDataObject)displayMerge.GetPolyDataOutput()); displayWarp.SetNormal((double)0,(double)1,(double)0); displayWarp.SetScaleFactor((double).000001); displayMapper = vtkPolyDataMapper.New(); displayMapper.SetInput((vtkPolyData)displayWarp.GetPolyDataOutput()); displayMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); displayActor = new vtkActor(); displayActor.SetMapper((vtkMapper)displayMapper); outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0); ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)probeActor); ren1.SetBackground((double)1,(double)1,(double)1); ren1.SetViewport((double)0,(double).25,(double)1,(double)1); ren2.AddActor((vtkProp)displayActor); ren2.SetBackground((double)0,(double)0,(double)0); ren2.SetViewport((double)0,(double)0,(double)1,(double).25); renWin.SetSize((int)300,(int)300); ren1.ResetCamera(); cam1 = ren1.GetActiveCamera(); cam1.SetClippingRange((double)3.95297,(double)50); cam1.SetFocalPoint((double)8.88908,(double)0.595038,(double)29.3342); cam1.SetPosition((double)9.9,(double)-26,(double)41); cam1.SetViewUp((double)0.060772,(double)-0.319905,(double)0.945498); ren2.ResetCamera(); cam2 = ren2.GetActiveCamera(); cam2.ParallelProjectionOn(); cam2.SetParallelScale((double).15); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVgeomFilter(String [] argv) { //Prefix Content is: "" // create pipeline - structured grid[] //[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)100); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); gf = new vtkGeometryFilter(); gf.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); gMapper = vtkPolyDataMapper.New(); gMapper.SetInputConnection((vtkAlgorithmOutput)gf.GetOutputPort()); gMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); gActor = new vtkActor(); gActor.SetMapper((vtkMapper)gMapper); gf2 = new vtkGeometryFilter(); gf2.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); gf2.ExtentClippingOn(); gf2.SetExtent((double)10,(double)17,(double)-6,(double)6,(double)23,(double)37); gf2.PointClippingOn(); gf2.SetPointMinimum((int)0); gf2.SetPointMaximum((int)10000); gf2.CellClippingOn(); gf2.SetCellMinimum((int)0); gf2.SetCellMaximum((int)7500); g2Mapper = vtkPolyDataMapper.New(); g2Mapper.SetInputConnection((vtkAlgorithmOutput)gf2.GetOutputPort()); g2Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); g2Actor = new vtkActor(); g2Actor.SetMapper((vtkMapper)g2Mapper); g2Actor.AddPosition((double)0,(double)15,(double)0); // create pipeline - poly data[] //[] gf3 = new vtkGeometryFilter(); gf3.SetInputConnection((vtkAlgorithmOutput)gf.GetOutputPort()); g3Mapper = vtkPolyDataMapper.New(); g3Mapper.SetInputConnection((vtkAlgorithmOutput)gf3.GetOutputPort()); g3Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); g3Actor = new vtkActor(); g3Actor.SetMapper((vtkMapper)g3Mapper); g3Actor.AddPosition((double)0,(double)0,(double)15); gf4 = new vtkGeometryFilter(); gf4.SetInputConnection((vtkAlgorithmOutput)gf2.GetOutputPort()); gf4.ExtentClippingOn(); gf4.SetExtent((double)10,(double)17,(double)-6,(double)6,(double)23,(double)37); gf4.PointClippingOn(); gf4.SetPointMinimum((int)0); gf4.SetPointMaximum((int)10000); gf4.CellClippingOn(); gf4.SetCellMinimum((int)0); gf4.SetCellMaximum((int)7500); g4Mapper = vtkPolyDataMapper.New(); g4Mapper.SetInputConnection((vtkAlgorithmOutput)gf4.GetOutputPort()); g4Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); g4Actor = new vtkActor(); g4Actor.SetMapper((vtkMapper)g4Mapper); g4Actor.AddPosition((double)0,(double)15,(double)15); // create pipeline - unstructured grid[] //[] s = new vtkSphere(); s.SetCenter(pl3d.GetOutput().GetCenter()[0],pl3d.GetOutput().GetCenter()[1],pl3d.GetOutput().GetCenter()[2]); s.SetRadius((double)100.0); //everything[] eg = new vtkExtractGeometry(); eg.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); eg.SetImplicitFunction((vtkImplicitFunction)s); gf5 = new vtkGeometryFilter(); gf5.SetInputConnection((vtkAlgorithmOutput)eg.GetOutputPort()); g5Mapper = vtkPolyDataMapper.New(); g5Mapper.SetInputConnection((vtkAlgorithmOutput)gf5.GetOutputPort()); g5Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); g5Actor = new vtkActor(); g5Actor.SetMapper((vtkMapper)g5Mapper); g5Actor.AddPosition((double)0,(double)0,(double)30); gf6 = new vtkGeometryFilter(); gf6.SetInputConnection((vtkAlgorithmOutput)eg.GetOutputPort()); gf6.ExtentClippingOn(); gf6.SetExtent((double)10,(double)17,(double)-6,(double)6,(double)23,(double)37); gf6.PointClippingOn(); gf6.SetPointMinimum((int)0); gf6.SetPointMaximum((int)10000); gf6.CellClippingOn(); gf6.SetCellMinimum((int)0); gf6.SetCellMaximum((int)7500); g6Mapper = vtkPolyDataMapper.New(); g6Mapper.SetInputConnection((vtkAlgorithmOutput)gf6.GetOutputPort()); g6Mapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); g6Actor = new vtkActor(); g6Actor.SetMapper((vtkMapper)g6Mapper); g6Actor.AddPosition((double)0,(double)15,(double)30); // create pipeline - rectilinear grid[] //[] rgridReader = new vtkRectilinearGridReader(); rgridReader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk"); rgridReader.Update(); gf7 = new vtkGeometryFilter(); gf7.SetInputConnection((vtkAlgorithmOutput)rgridReader.GetOutputPort()); g7Mapper = vtkPolyDataMapper.New(); g7Mapper.SetInputConnection((vtkAlgorithmOutput)gf7.GetOutputPort()); g7Mapper.SetScalarRange((double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[1]); g7Actor = new vtkActor(); g7Actor.SetMapper((vtkMapper)g7Mapper); g7Actor.SetScale((double)3,(double)3,(double)3); gf8 = new vtkGeometryFilter(); gf8.SetInputConnection((vtkAlgorithmOutput)rgridReader.GetOutputPort()); gf8.ExtentClippingOn(); gf8.SetExtent((double)0,(double)1,(double)-2,(double)2,(double)0,(double)4); gf8.PointClippingOn(); gf8.SetPointMinimum((int)0); gf8.SetPointMaximum((int)10000); gf8.CellClippingOn(); gf8.SetCellMinimum((int)0); gf8.SetCellMaximum((int)7500); g8Mapper = vtkPolyDataMapper.New(); g8Mapper.SetInputConnection((vtkAlgorithmOutput)gf8.GetOutputPort()); g8Mapper.SetScalarRange((double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)rgridReader.GetOutput()).GetScalarRange()[1]); g8Actor = new vtkActor(); g8Actor.SetMapper((vtkMapper)g8Mapper); g8Actor.SetScale((double)3,(double)3,(double)3); g8Actor.AddPosition((double)0,(double)15,(double)0); // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); ren1.AddActor((vtkProp)gActor); ren1.AddActor((vtkProp)g2Actor); ren1.AddActor((vtkProp)g3Actor); ren1.AddActor((vtkProp)g4Actor); ren1.AddActor((vtkProp)g5Actor); ren1.AddActor((vtkProp)g6Actor); ren1.AddActor((vtkProp)g7Actor); ren1.AddActor((vtkProp)g8Actor); renWin.SetSize((int)340,(int)550); cam1 = ren1.GetActiveCamera(); cam1.SetClippingRange((double)84,(double)174); cam1.SetFocalPoint((double)5.22824,(double)6.09412,(double)35.9813); cam1.SetPosition((double)100.052,(double)62.875,(double)102.818); cam1.SetViewUp((double)-0.307455,(double)-0.464269,(double)0.830617); iren.Initialize(); // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVmultipleIso(String [] argv) { //Prefix Content is: "" // get the interactor ui[] //# Graphics stuff[] // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)100); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); range = pl3d.GetOutput().GetPointData().GetScalars().GetRange(); min = (double)(lindex(range,0)); max = (double)(lindex(range,1)); value = (min+max)/2.0; cf = new vtkContourFilter(); cf.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); cf.SetValue((int)0,(double)value); cf.UseScalarTreeOn(); numberOfContours = 5; epsilon = (double)(max-min)/(double)(numberOfContours*10); min = min+epsilon; max = max-epsilon; i = 1; while((i) <= numberOfContours) { cf.SetValue((int)0,(double)min+((i-1)/(double)(numberOfContours-1))*(max-min)); cf.Update(); pd[i] = new vtkPolyData(); pd[i].CopyStructure((vtkDataSet)cf.GetOutput()); pd[i].GetPointData().DeepCopy((vtkFieldData)cf.GetOutput().GetPointData()); mapper[i] = vtkPolyDataMapper.New(); mapper[i].SetInput((vtkPolyData)pd[i]); mapper[i].SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetPointData().GetScalars().GetRange()[1]); actor[i] = new vtkActor(); actor[i].AddPosition((double)0,(double)i*12,(double)0); actor[i].SetMapper((vtkMapper)mapper[i]); ren1.AddActor((vtkProp)actor[i]); i = i + 1; } // Add the actors to the renderer, set the background and size[] //[] ren1.SetBackground((double).3,(double).3,(double).3); renWin.SetSize((int)450,(int)150); cam1 = ren1.GetActiveCamera(); ren1.GetActiveCamera().SetPosition((double)-36.3762,(double)32.3855,(double)51.3652); ren1.GetActiveCamera().SetFocalPoint((double)8.255,(double)33.3861,(double)29.7687); ren1.GetActiveCamera().SetViewAngle((double)30); ren1.GetActiveCamera().SetViewUp((double)0,(double)0,(double)1); ren1.ResetCameraClippingRange(); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVprobe(String [] argv) { //Prefix Content is: "" // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // cut data[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)100); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); plane = new vtkPlane(); plane.SetOrigin(pl3d.GetOutput().GetCenter()[0],pl3d.GetOutput().GetCenter()[1],pl3d.GetOutput().GetCenter()[2]); plane.SetNormal((double)-0.287,(double)0,(double)0.9579); planeCut = new vtkCutter(); planeCut.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); planeCut.SetCutFunction((vtkImplicitFunction)plane); probe = new vtkProbeFilter(); probe.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort()); probe.SetSourceConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); cutMapper = new vtkDataSetMapper(); cutMapper.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort()); cutMapper.SetScalarRange((double)((vtkStructuredGrid)pl3d.GetOutput()).GetPointData().GetScalars().GetRange()[0], (double)((vtkStructuredGrid)pl3d.GetOutput()).GetPointData().GetScalars().GetRange()[1]); cutActor = new vtkActor(); cutActor.SetMapper((vtkMapper)cutMapper); //extract plane[] compPlane = new vtkStructuredGridGeometryFilter(); compPlane.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); compPlane.SetExtent((int)0,(int)100,(int)0,(int)100,(int)9,(int)9); planeMapper = vtkPolyDataMapper.New(); planeMapper.SetInputConnection((vtkAlgorithmOutput)compPlane.GetOutputPort()); planeMapper.ScalarVisibilityOff(); planeActor = new vtkActor(); planeActor.SetMapper((vtkMapper)planeMapper); planeActor.GetProperty().SetRepresentationToWireframe(); planeActor.GetProperty().SetColor((double)0,(double)0,(double)0); //outline[] outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineProp = outlineActor.GetProperty(); outlineProp.SetColor((double)0,(double)0,(double)0); // Add the actors to the renderer, set the background and size[] //[] ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)planeActor); ren1.AddActor((vtkProp)cutActor); ren1.SetBackground((double)1,(double)1,(double)1); renWin.SetSize((int)400,(int)300); cam1 = ren1.GetActiveCamera(); cam1.SetClippingRange((double)11.1034,(double)59.5328); cam1.SetFocalPoint((double)9.71821,(double)0.458166,(double)29.3999); cam1.SetPosition((double)-2.95748,(double)-26.7271,(double)44.5309); cam1.SetViewUp((double)0.0184785,(double)0.479657,(double)0.877262); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVTestMultiBlockStreamer(String [] argv) { //Prefix Content is: "" // we need to use composite data pipeline with multiblock datasets[] alg = new vtkAlgorithm(); pip = new vtkCompositeDataPipeline(); vtkAlgorithm.SetDefaultExecutivePrototype((vtkExecutive)pip); //skipping Delete pip Ren1 = vtkRenderer.New(); Ren1.SetBackground((double)0.33,(double)0.35,(double)0.43); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)Ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); Plot3D0 = new vtkPLOT3DReader(); Plot3D0.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); Plot3D0.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); Plot3D0.SetBinaryFile((int)1); Plot3D0.SetMultiGrid((int)0); Plot3D0.SetHasByteCount((int)0); Plot3D0.SetIBlanking((int)0); Plot3D0.SetTwoDimensionalGeometry((int)0); Plot3D0.SetForceRead((int)0); Plot3D0.SetByteOrder((int)0); Geometry5 = new vtkStructuredGridOutlineFilter(); Geometry5.SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort()); Mapper5 = vtkPolyDataMapper.New(); Mapper5.SetInputConnection((vtkAlgorithmOutput)Geometry5.GetOutputPort()); Mapper5.SetImmediateModeRendering((int)1); Mapper5.UseLookupTableScalarRangeOn(); Mapper5.SetScalarVisibility((int)0); Mapper5.SetScalarModeToDefault(); Actor5 = new vtkActor(); Actor5.SetMapper((vtkMapper)Mapper5); Actor5.GetProperty().SetRepresentationToSurface(); Actor5.GetProperty().SetInterpolationToGouraud(); Actor5.GetProperty().SetAmbient((double)0.15); Actor5.GetProperty().SetDiffuse((double)0.85); Actor5.GetProperty().SetSpecular((double)0.1); Actor5.GetProperty().SetSpecularPower((double)100); Actor5.GetProperty().SetSpecularColor((double)1,(double)1,(double)1); Actor5.GetProperty().SetColor((double)1,(double)1,(double)1); Ren1.AddActor((vtkProp)Actor5); ExtractGrid[0] = new vtkExtractGrid(); ExtractGrid[0].SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort()); ExtractGrid[0].SetVOI((int)0,(int)14,(int)0,(int)32,(int)0,(int)24); ExtractGrid[0].SetSampleRate((int)1,(int)1,(int)1); ExtractGrid[0].SetIncludeBoundary((int)0); ExtractGrid[1] = new vtkExtractGrid(); ExtractGrid[1].SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort()); ExtractGrid[1].SetVOI((int)14,(int)29,(int)0,(int)32,(int)0,(int)24); ExtractGrid[1].SetSampleRate((int)1,(int)1,(int)1); ExtractGrid[1].SetIncludeBoundary((int)0); ExtractGrid[2] = new vtkExtractGrid(); ExtractGrid[2].SetInputConnection((vtkAlgorithmOutput)Plot3D0.GetOutputPort()); ExtractGrid[2].SetVOI((int)29,(int)56,(int)0,(int)32,(int)0,(int)24); ExtractGrid[2].SetSampleRate((int)1,(int)1,(int)1); ExtractGrid[2].SetIncludeBoundary((int)0); LineSourceWidget0 = new vtkLineSource(); LineSourceWidget0.SetPoint1((double)3.05638,(double)-3.00497,(double)28.2211); LineSourceWidget0.SetPoint2((double)3.05638,(double)3.95916,(double)28.2211); LineSourceWidget0.SetResolution((int)20); mbds = new vtkMultiBlockDataSet(); mbds.SetNumberOfBlocks((uint)3); i = 0; while((i) < 3) { ExtractGrid[i].Update(); sg[i] = vtkStructuredGrid.New(); sg[i].ShallowCopy(ExtractGrid[i].GetOutput()); mbds.SetBlock((uint)i, sg[i]); //skipping Delete sg[i] i = i + 1; } Stream0 = new vtkStreamTracer(); Stream0.SetInput((vtkDataObject)mbds); Stream0.SetSource((vtkDataSet)LineSourceWidget0.GetOutput()); Stream0.SetIntegrationStepUnit(2); Stream0.SetMaximumPropagation((double)20); Stream0.SetInitialIntegrationStep((double)0.5); Stream0.SetIntegrationDirection((int)0); Stream0.SetIntegratorType((int)0); Stream0.SetMaximumNumberOfSteps((int)2000); Stream0.SetTerminalSpeed((double)1e-12); //skipping Delete mbds aa = new vtkAssignAttribute(); aa.SetInputConnection((vtkAlgorithmOutput)Stream0.GetOutputPort()); aa.Assign((string)"Normals",(string)"NORMALS",(string)"POINT_DATA"); Ribbon0 = new vtkRibbonFilter(); Ribbon0.SetInputConnection((vtkAlgorithmOutput)aa.GetOutputPort()); Ribbon0.SetWidth((double)0.1); Ribbon0.SetAngle((double)0); Ribbon0.SetDefaultNormal((double)0,(double)0,(double)1); Ribbon0.SetVaryWidth((int)0); LookupTable1 = new vtkLookupTable(); LookupTable1.SetNumberOfTableValues((int)256); LookupTable1.SetHueRange((double)0,(double)0.66667); LookupTable1.SetSaturationRange((double)1,(double)1); LookupTable1.SetValueRange((double)1,(double)1); LookupTable1.SetTableRange((double)0.197813,(double)0.710419); LookupTable1.SetVectorComponent((int)0); LookupTable1.Build(); Mapper10 = vtkPolyDataMapper.New(); Mapper10.SetInputConnection((vtkAlgorithmOutput)Ribbon0.GetOutputPort()); Mapper10.SetImmediateModeRendering((int)1); Mapper10.UseLookupTableScalarRangeOn(); Mapper10.SetScalarVisibility((int)1); Mapper10.SetScalarModeToUsePointFieldData(); Mapper10.SelectColorArray((string)"Density"); Mapper10.SetLookupTable((vtkScalarsToColors)LookupTable1); Actor10 = new vtkActor(); Actor10.SetMapper((vtkMapper)Mapper10); Actor10.GetProperty().SetRepresentationToSurface(); Actor10.GetProperty().SetInterpolationToGouraud(); Actor10.GetProperty().SetAmbient((double)0.15); Actor10.GetProperty().SetDiffuse((double)0.85); Actor10.GetProperty().SetSpecular((double)0); Actor10.GetProperty().SetSpecularPower((double)1); Actor10.GetProperty().SetSpecularColor((double)1,(double)1,(double)1); Ren1.AddActor((vtkProp)Actor10); // enable user interface interactor[] iren.Initialize(); // prevent the tk window from showing up then start the event loop[] vtkAlgorithm.SetDefaultExecutivePrototype(null); //skipping Delete alg //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVTestPDataSetReaderGrid(String [] argv) { //Prefix Content is: "" // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); //[] // If the current directory is writable, then test the witers[] //[] try { channel = new StreamWriter("test.tmp"); tryCatchError = "NOERROR"; } catch(Exception) { tryCatchError = "ERROR"; } if(tryCatchError.Equals("NOERROR")) { channel.Close(); File.Delete("test.tmp"); // ====== Structured Grid ======[] // First save out a grid in parallel form.[] reader = new vtkPLOT3DReader(); reader.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); reader.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); writer = new vtkPDataSetWriter(); writer.SetFileName((string)"comb.pvtk"); writer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort()); writer.SetNumberOfPieces((int)4); writer.Write(); pReader = new vtkPDataSetReader(); pReader.SetFileName((string)"comb.pvtk"); surface = new vtkDataSetSurfaceFilter(); surface.SetInputConnection((vtkAlgorithmOutput)pReader.GetOutputPort()); mapper = vtkPolyDataMapper.New(); mapper.SetInputConnection((vtkAlgorithmOutput)surface.GetOutputPort()); mapper.SetNumberOfPieces((int)2); mapper.SetPiece((int)0); mapper.SetGhostLevel((int)1); mapper.Update(); File.Delete("comb.pvtk"); File.Delete("comb.0.vtk"); File.Delete("comb.1.vtk"); File.Delete("comb.2.vtk"); File.Delete("comb.3.vtk"); actor = new vtkActor(); actor.SetMapper((vtkMapper)mapper); actor.SetPosition((double)-5,(double)0,(double)-29); // Add the actors to the renderer, set the background and size[] //[] ren1.AddActor((vtkProp)actor); // ====== ImageData ======[] // First save out a grid in parallel form.[] fractal = new vtkImageMandelbrotSource(); fractal.SetWholeExtent((int)0,(int)9,(int)0,(int)9,(int)0,(int)9); fractal.SetSampleCX((double)0.1,(double)0.1,(double)0.1,(double)0.1); fractal.SetMaximumNumberOfIterations((ushort)10); writer2 = new vtkPDataSetWriter(); writer.SetFileName((string)"fractal.pvtk"); writer.SetInputConnection((vtkAlgorithmOutput)fractal.GetOutputPort()); writer.SetNumberOfPieces((int)4); writer.Write(); pReader2 = new vtkPDataSetReader(); pReader2.SetFileName((string)"fractal.pvtk"); iso = new vtkContourFilter(); iso.SetInputConnection((vtkAlgorithmOutput)pReader2.GetOutputPort()); iso.SetValue((int)0,(double)4); mapper2 = vtkPolyDataMapper.New(); mapper2.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort()); mapper2.SetNumberOfPieces((int)3); mapper2.SetPiece((int)0); mapper2.SetGhostLevel((int)0); mapper2.Update(); File.Delete("fractal.pvtk"); File.Delete("fractal.0.vtk"); File.Delete("fractal.1.vtk"); File.Delete("fractal.2.vtk"); File.Delete("fractal.3.vtk"); actor2 = new vtkActor(); actor2.SetMapper((vtkMapper)mapper2); actor2.SetScale((double)5,(double)5,(double)5); actor2.SetPosition((double)6,(double)6,(double)6); // Add the actors to the renderer, set the background and size[] //[] ren1.AddActor((vtkProp)actor2); // ====== PolyData ======[] // First save out a grid in parallel form.[] sphere = new vtkSphereSource(); sphere.SetRadius((double)2); writer3 = new vtkPDataSetWriter(); writer3.SetFileName((string)"sphere.pvtk"); writer3.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort()); writer3.SetNumberOfPieces((int)4); writer3.Write(); pReader3 = new vtkPDataSetReader(); pReader3.SetFileName((string)"sphere.pvtk"); mapper3 = vtkPolyDataMapper.New(); mapper3.SetInputConnection((vtkAlgorithmOutput)pReader3.GetOutputPort()); mapper3.SetNumberOfPieces((int)2); mapper3.SetPiece((int)0); mapper3.SetGhostLevel((int)1); mapper3.Update(); File.Delete("sphere.pvtk"); File.Delete("sphere.0.vtk"); File.Delete("sphere.1.vtk"); File.Delete("sphere.2.vtk"); File.Delete("sphere.3.vtk"); actor3 = new vtkActor(); actor3.SetMapper((vtkMapper)mapper3); actor3.SetPosition((double)6,(double)6,(double)6); // Add the actors to the renderer, set the background and size[] //[] ren1.AddActor((vtkProp)actor3); } ren1.SetBackground((double)0.1,(double)0.2,(double)0.4); renWin.SetSize((int)300,(int)300); // render the image[] //[] cam1 = ren1.GetActiveCamera(); cam1.Azimuth((double)20); cam1.Elevation((double)40); ren1.ResetCamera(); cam1.Zoom((double)1.2); iren.Initialize(); // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVPlot3DVectors(String [] argv) { //Prefix Content is: "" //[] // All Plot3D vector functions[] //[] // Create the RenderWindow, Renderer and both Actors[] //[] renWin = vtkRenderWindow.New(); ren1 = vtkRenderer.New(); ren1.SetBackground((double).8,(double).8,(double).2); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); vectorLabels = "Velocity Vorticity Momentum Pressure_Gradient"; vectorFunctions = "200 201 202 210"; camera = new vtkCamera(); light = new vtkLight(); // All text actors will share the same text prop[] textProp = new vtkTextProperty(); textProp.SetFontSize((int)10); textProp.SetFontFamilyToArial(); textProp.SetColor((double).3,(double)1,(double)1); i = 0; foreach (string vectorFunction in vectorFunctions.Split(new char[]{' '})) { pl3d[getArrayIndex(vectorFunction)] = new vtkPLOT3DReader(); pl3d[getArrayIndex(vectorFunction)].SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinxyz.bin"); pl3d[getArrayIndex(vectorFunction)].SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinq.bin"); pl3d[getArrayIndex(vectorFunction)].SetVectorFunctionNumber((int)(int)(getArrayIndex(vectorFunction))); pl3d[getArrayIndex(vectorFunction)].Update(); plane[getArrayIndex(vectorFunction)] = new vtkStructuredGridGeometryFilter(); plane[getArrayIndex(vectorFunction)].SetInputConnection((vtkAlgorithmOutput)pl3d[getArrayIndex(vectorFunction)].GetOutputPort()); plane[getArrayIndex(vectorFunction)].SetExtent((int)25,(int)25,(int)0,(int)100,(int)0,(int)100); hog[getArrayIndex(vectorFunction)] = new vtkHedgeHog(); hog[getArrayIndex(vectorFunction)].SetInputConnection((vtkAlgorithmOutput)plane[getArrayIndex(vectorFunction)].GetOutputPort()); maxnorm = pl3d[getArrayIndex(vectorFunction)].GetOutput().GetPointData().GetVectors().GetMaxNorm(); hog[getArrayIndex(vectorFunction)].SetScaleFactor((double)1.0/maxnorm); mapper[getArrayIndex(vectorFunction)] = vtkPolyDataMapper.New(); mapper[getArrayIndex(vectorFunction)].SetInputConnection((vtkAlgorithmOutput)hog[getArrayIndex(vectorFunction)].GetOutputPort()); actor[getArrayIndex(vectorFunction)] = new vtkActor(); actor[getArrayIndex(vectorFunction)].SetMapper((vtkMapper)mapper[getArrayIndex(vectorFunction)]); ren[getArrayIndex(vectorFunction)] = vtkRenderer.New(); ren[getArrayIndex(vectorFunction)].SetBackground((double)0.5,(double).5,(double).5); ren[getArrayIndex(vectorFunction)].SetActiveCamera((vtkCamera)camera); ren[getArrayIndex(vectorFunction)].AddLight((vtkLight)light); renWin.AddRenderer(ren[getArrayIndex(vectorFunction)]); ren[getArrayIndex(vectorFunction)].AddActor((vtkProp)actor[getArrayIndex(vectorFunction)]); textMapper[getArrayIndex(vectorFunction)] = new vtkTextMapper(); textMapper[getArrayIndex(vectorFunction)].SetInput(vectorLabels.Split(new char[] { ' ' })[i]); textMapper[getArrayIndex(vectorFunction)].SetTextProperty((vtkTextProperty)textProp); text[getArrayIndex(vectorFunction)] = new vtkActor2D(); text[getArrayIndex(vectorFunction)].SetMapper((vtkMapper2D)textMapper[getArrayIndex(vectorFunction)]); text[getArrayIndex(vectorFunction)].SetPosition((double)2,(double)5); ren[getArrayIndex(vectorFunction)].AddActor2D((vtkProp)text[getArrayIndex(vectorFunction)]); i = i + 1; } //[] // now layout renderers[] column = 1; row = 1; deltaX = 1.0/2.0; deltaY = 1.0/2.0; foreach (string vectorFunction in vectorFunctions.Split(new char[]{' '})) { ren[getArrayIndex(vectorFunction)].SetViewport((double)(column - 1) * deltaX + (deltaX * .05), (double)(row - 1) * deltaY + (deltaY * .05), (double)column * deltaX - (deltaX * .05), (double)row * deltaY - (deltaY * .05)); column = column + 1; if ((column) > 2) { column = 1; row = row + 1; } } camera.SetViewUp((double)1,(double)0,(double)0); camera.SetFocalPoint((double)0,(double)0,(double)0); camera.SetPosition((double).4,(double)-.5,(double)-.75); ren[200].ResetCamera(); camera.Dolly((double)1.25); ren[200].ResetCameraClippingRange(); ren[201].ResetCameraClippingRange(); ren[202].ResetCameraClippingRange(); ren[210].ResetCameraClippingRange(); light.SetPosition(camera.GetPosition()[0],camera.GetPosition()[1],camera.GetPosition()[2]); light.SetFocalPoint(camera.GetFocalPoint()[0],camera.GetFocalPoint()[1],camera.GetFocalPoint()[2]); renWin.SetSize(350,350); renWin.Render(); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// Entry Point /// </summary> /// <param name="argv"></param> public static void Main(String[] argv) { // This example demonstrates how to use the vtkLineWidget to seed // and manipulate streamlines. Two line widgets are created. One is // invoked by pressing 'W', the other by pressing 'L'. Both can exist // together. // Start by loading some data. pl3d = vtkPLOT3DReader.New(); pl3d.SetXYZFileName("../../../combxyz.bin"); pl3d.SetQFileName("../../../combq.bin"); pl3d.SetScalarFunctionNumber(100); pl3d.SetVectorFunctionNumber(202); pl3d.Update(); // The line widget is used seed the streamlines. lineWidget = vtkLineWidget.New(); seeds = vtkPolyData.New(); lineWidget.SetInput(pl3d.GetOutput()); lineWidget.SetAlignToYAxis(); lineWidget.PlaceWidget(); lineWidget.GetPolyData(seeds); lineWidget.ClampToBoundsOn(); rk4 = vtkRungeKutta4.New(); streamer = vtkStreamLine.New(); streamer.SetInputConnection(pl3d.GetOutputPort()); streamer.SetSource(seeds); streamer.SetMaximumPropagationTime(100); streamer.SetIntegrationStepLength(.2); streamer.SetStepLength(.001); streamer.SetNumberOfThreads(1); streamer.SetIntegrationDirectionToForward(); streamer.VorticityOn(); streamer.SetIntegrator(rk4); rf = vtkRibbonFilter.New(); rf.SetInputConnection(streamer.GetOutputPort()); rf.SetWidth(0.1); rf.SetWidthFactor(5); streamMapper = vtkPolyDataMapper.New(); streamMapper.SetInputConnection(rf.GetOutputPort()); streamMapper.SetScalarRange(pl3d.GetOutput().GetScalarRange()[0], pl3d.GetOutput().GetScalarRange()[1]); streamline = vtkActor.New(); streamline.SetMapper(streamMapper); streamline.VisibilityOff(); // The second line widget is used seed more streamlines. lineWidget2 = vtkLineWidget.New(); seeds2 = vtkPolyData.New(); lineWidget2.SetInput(pl3d.GetOutput()); lineWidget2.PlaceWidget(); lineWidget2.GetPolyData(seeds2); lineWidget2.SetKeyPressActivationValue((sbyte)108); streamer2 = vtkStreamLine.New(); streamer2.SetInputConnection(pl3d.GetOutputPort()); streamer2.SetSource(seeds2); streamer2.SetMaximumPropagationTime(100); streamer2.SetIntegrationStepLength(.2); streamer2.SetStepLength(.001); streamer2.SetNumberOfThreads(1); streamer2.SetIntegrationDirectionToForward(); streamer2.VorticityOn(); streamer2.SetIntegrator(rk4); rf2 = vtkRibbonFilter.New(); rf2.SetInputConnection(streamer2.GetOutputPort()); rf2.SetWidth(0.1); rf2.SetWidthFactor(5); streamMapper2 = vtkPolyDataMapper.New(); streamMapper2.SetInputConnection(rf2.GetOutputPort()); streamMapper2.SetScalarRange(pl3d.GetOutput().GetScalarRange()[0], pl3d.GetOutput().GetScalarRange()[1]); streamline2 = vtkActor.New(); streamline2.SetMapper(streamMapper2); streamline2.VisibilityOff(); outline = vtkStructuredGridOutlineFilter.New(); outline.SetInputConnection(pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection(outline.GetOutputPort()); outlineActor = vtkActor.New(); outlineActor.SetMapper(outlineMapper); // Create the RenderWindow, Renderer and both Actors ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer(ren1); iren = vtkRenderWindowInteractor.New(); iren.SetRenderWindow(renWin); // Associate the line widget with the interactor lineWidget.SetInteractor(iren); lineWidget.StartInteractionEvt += new vtkObject.vtkObjectEventHandler(BeginInteraction); lineWidget.InteractionEvt += new vtkObject.vtkObjectEventHandler(GenerateStreamlines); lineWidget2.SetInteractor(iren); lineWidget2.StartInteractionEvt += new vtkObject.vtkObjectEventHandler(BeginInteraction2); lineWidget2.EndInteractionEvt += new vtkObject.vtkObjectEventHandler(GenerateStreamlines2); // Add the actors to the renderer, set the background and size ren1.AddActor(outlineActor); ren1.AddActor(streamline); ren1.AddActor(streamline2); ren1.SetBackground(1, 1, 1); renWin.SetSize(300, 300); ren1.SetBackground(0.1, 0.2, 0.4); cam1 = ren1.GetActiveCamera(); cam1.SetClippingRange(3.95297, 50); cam1.SetFocalPoint(9.71821, 0.458166, 29.3999); cam1.SetPosition(2.7439, -37.3196, 38.7167); cam1.SetViewUp(-0.16123, 0.264271, 0.950876); // render the image renWin.Render(); lineWidget2.On(); iren.Initialize(); iren.Start(); //Clean Up deleteAllVTKObjects(); }
///<summary> A Set Method for Static Variables </summary> public static void Setreader(vtkPLOT3DReader toSet) { reader = toSet; }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVprobeComb(String [] argv) { //Prefix Content is: "" // create planes[] // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // create pipeline[] //[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)100); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); plane = new vtkPlaneSource(); plane.SetResolution((int)50,(int)50); transP1 = new vtkTransform(); transP1.Translate((double)3.7,(double)0.0,(double)28.37); transP1.Scale((double)5,(double)5,(double)5); transP1.RotateY((double)90); tpd1 = new vtkTransformPolyDataFilter(); tpd1.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort()); tpd1.SetTransform((vtkAbstractTransform)transP1); outTpd1 = new vtkOutlineFilter(); outTpd1.SetInputConnection((vtkAlgorithmOutput)tpd1.GetOutputPort()); mapTpd1 = vtkPolyDataMapper.New(); mapTpd1.SetInputConnection((vtkAlgorithmOutput)outTpd1.GetOutputPort()); tpd1Actor = new vtkActor(); tpd1Actor.SetMapper((vtkMapper)mapTpd1); tpd1Actor.GetProperty().SetColor((double)0,(double)0,(double)0); transP2 = new vtkTransform(); transP2.Translate((double)9.2,(double)0.0,(double)31.20); transP2.Scale((double)5,(double)5,(double)5); transP2.RotateY((double)90); tpd2 = new vtkTransformPolyDataFilter(); tpd2.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort()); tpd2.SetTransform((vtkAbstractTransform)transP2); outTpd2 = new vtkOutlineFilter(); outTpd2.SetInputConnection((vtkAlgorithmOutput)tpd2.GetOutputPort()); mapTpd2 = vtkPolyDataMapper.New(); mapTpd2.SetInputConnection((vtkAlgorithmOutput)outTpd2.GetOutputPort()); tpd2Actor = new vtkActor(); tpd2Actor.SetMapper((vtkMapper)mapTpd2); tpd2Actor.GetProperty().SetColor((double)0,(double)0,(double)0); transP3 = new vtkTransform(); transP3.Translate((double)13.27,(double)0.0,(double)33.30); transP3.Scale((double)5,(double)5,(double)5); transP3.RotateY((double)90); tpd3 = new vtkTransformPolyDataFilter(); tpd3.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort()); tpd3.SetTransform((vtkAbstractTransform)transP3); outTpd3 = new vtkOutlineFilter(); outTpd3.SetInputConnection((vtkAlgorithmOutput)tpd3.GetOutputPort()); mapTpd3 = vtkPolyDataMapper.New(); mapTpd3.SetInputConnection((vtkAlgorithmOutput)outTpd3.GetOutputPort()); tpd3Actor = new vtkActor(); tpd3Actor.SetMapper((vtkMapper)mapTpd3); tpd3Actor.GetProperty().SetColor((double)0,(double)0,(double)0); appendF = new vtkAppendPolyData(); appendF.AddInput((vtkPolyData)tpd1.GetOutput()); appendF.AddInput((vtkPolyData)tpd2.GetOutput()); appendF.AddInput((vtkPolyData)tpd3.GetOutput()); probe = new vtkProbeFilter(); probe.SetInputConnection((vtkAlgorithmOutput)appendF.GetOutputPort()); probe.SetSource((vtkDataObject)pl3d.GetOutput()); contour = new vtkContourFilter(); contour.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort()); contour.GenerateValues((int)50,(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); contourMapper = vtkPolyDataMapper.New(); contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort()); contourMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); planeActor = new vtkActor(); planeActor.SetMapper((vtkMapper)contourMapper); outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0); ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)planeActor); ren1.AddActor((vtkProp)tpd1Actor); ren1.AddActor((vtkProp)tpd2Actor); ren1.AddActor((vtkProp)tpd3Actor); ren1.SetBackground((double)1,(double)1,(double)1); renWin.SetSize((int)400,(int)400); cam1 = ren1.GetActiveCamera(); cam1.SetClippingRange((double)3.95297,(double)50); cam1.SetFocalPoint((double)8.88908,(double)0.595038,(double)29.3342); cam1.SetPosition((double)-12.3332,(double)31.7479,(double)41.2387); cam1.SetViewUp((double)0.060772,(double)-0.319905,(double)0.945498); iren.Initialize(); // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVPlot3DScalars(String[] argv) { //Prefix Content is: "" //[] // All Plot3D scalar functions[] //[] // Create the RenderWindow, Renderer and both Actors[] //[] renWin = vtkRenderWindow.New(); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); scalarLabels = "Density Pressure Temperature Enthalpy Internal_Energy Kinetic_Energy Velocity_Magnitude Stagnation_Energy Entropy Swirl"; scalarFunctions = "100 110 120 130 140 144 153 163 170 184"; camera = new vtkCamera(); light = new vtkLight(); math = new vtkMath(); // All text actors will share the same text prop[] textProp = new vtkTextProperty(); textProp.SetFontSize((int)10); textProp.SetFontFamilyToArial(); textProp.SetColor((double)0, (double)0, (double)0); i = 0; foreach (string scalarFunction in scalarFunctions.Split(new char[] { ' ' })) { pl3d[getArrayIndex(scalarFunction)] = new vtkPLOT3DReader(); pl3d[getArrayIndex(scalarFunction)].SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinxyz.bin"); pl3d[getArrayIndex(scalarFunction)].SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinq.bin"); pl3d[getArrayIndex(scalarFunction)].SetScalarFunctionNumber((int)(int)(Int32.Parse(scalarFunction))); pl3d[getArrayIndex(scalarFunction)].Update(); plane[getArrayIndex(scalarFunction)] = new vtkStructuredGridGeometryFilter(); plane[getArrayIndex(scalarFunction)].SetInputConnection((vtkAlgorithmOutput)pl3d[getArrayIndex(scalarFunction)].GetOutputPort()); plane[getArrayIndex(scalarFunction)].SetExtent((int)25, (int)25, (int)0, (int)100, (int)0, (int)100); mapper[getArrayIndex(scalarFunction)] = vtkPolyDataMapper.New(); mapper[getArrayIndex(scalarFunction)].SetInputConnection((vtkAlgorithmOutput)plane[getArrayIndex(scalarFunction)].GetOutputPort()); mapper[getArrayIndex(scalarFunction)].SetScalarRange((double)((vtkDataSet)pl3d[getArrayIndex(scalarFunction)].GetOutput()).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)pl3d[getArrayIndex(scalarFunction)].GetOutput()).GetPointData().GetScalars().GetRange()[1]); actor[getArrayIndex(scalarFunction)] = new vtkActor(); actor[getArrayIndex(scalarFunction)].SetMapper((vtkMapper)mapper[getArrayIndex(scalarFunction)]); ren[getArrayIndex(scalarFunction)] = vtkRenderer.New(); ren[getArrayIndex(scalarFunction)].SetBackground((double)0, (double)0, (double).5); ren[getArrayIndex(scalarFunction)].SetActiveCamera((vtkCamera)camera); ren[getArrayIndex(scalarFunction)].AddLight((vtkLight)light); renWin.AddRenderer(ren[getArrayIndex(scalarFunction)]); ren[getArrayIndex(scalarFunction)].SetBackground((double)vtkMath.Random((double).5, (double)1), (double)vtkMath.Random((double).5, (double)1), (double)vtkMath.Random((double).5, (double)1)); ren[getArrayIndex(scalarFunction)].AddActor((vtkProp)actor[getArrayIndex(scalarFunction)]); textMapper[getArrayIndex(scalarFunction)] = new vtkTextMapper(); textMapper[getArrayIndex(scalarFunction)].SetInput(scalarLabels.Split(new char[] { ' ' })[i]); textMapper[getArrayIndex(scalarFunction)].SetTextProperty((vtkTextProperty)textProp); text[getArrayIndex(scalarFunction)] = new vtkActor2D(); text[getArrayIndex(scalarFunction)].SetMapper((vtkMapper2D)textMapper[getArrayIndex(scalarFunction)]); text[getArrayIndex(scalarFunction)].SetPosition((double)2, (double)3); ren[getArrayIndex(scalarFunction)].AddActor2D(text[getArrayIndex(scalarFunction)]); i = i + 1; } //[] // now layout renderers[] column = 1; row = 1; deltaX = 1.0 / 5.0; deltaY = 1.0 / 2.0; foreach (string scalarFunction in scalarFunctions.Split(new char[] { ' ' })) { ren[getArrayIndex(scalarFunction)].SetViewport((double)(column - 1) * deltaX, (double)(row - 1) * deltaY, (double)column * deltaX, (double)row * deltaY); column = column + 1; if ((column) > 5) { column = 1; row = row + 1; } } camera.SetViewUp((double)0, (double)1, (double)0); camera.SetFocalPoint((double)0, (double)0, (double)0); camera.SetPosition((double)1, (double)0, (double)0); ren[100].ResetCamera(); camera.Dolly((double)1.25); ren[100].ResetCameraClippingRange(); ren[110].ResetCameraClippingRange(); ren[120].ResetCameraClippingRange(); ren[130].ResetCameraClippingRange(); ren[140].ResetCameraClippingRange(); ren[144].ResetCameraClippingRange(); ren[153].ResetCameraClippingRange(); ren[163].ResetCameraClippingRange(); ren[170].ResetCameraClippingRange(); ren[184].ResetCameraClippingRange(); light.SetPosition(camera.GetPosition()[0], camera.GetPosition()[1], camera.GetPosition()[2]); light.SetFocalPoint(camera.GetFocalPoint()[0], camera.GetFocalPoint()[1], camera.GetFocalPoint()[2]); renWin.SetSize(600, 180); renWin.Render(); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVTestGridSynchronizedTemplates3D(String [] argv) { //Prefix Content is: "" // cut data[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)100); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); range = pl3d.GetOutput().GetPointData().GetScalars().GetRange(); min = (double)(lindex(range,0)); max = (double)(lindex(range,1)); value = (min+max)/2.0; //vtkGridSynchronizedTemplates3D cf[] cf = new vtkContourFilter(); cf.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); cf.SetValue((int)0,(double)value); //cf ComputeNormalsOff[] cfMapper = vtkPolyDataMapper.New(); cfMapper.ImmediateModeRenderingOn(); cfMapper.SetInputConnection((vtkAlgorithmOutput)cf.GetOutputPort()); cfMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetPointData().GetScalars().GetRange()[1]); cfActor = new vtkActor(); cfActor.SetMapper((vtkMapper)cfMapper); //outline[] outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0); //# Graphics stuff[] // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // Add the actors to the renderer, set the background and size[] //[] ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)cfActor); ren1.SetBackground((double)1,(double)1,(double)1); renWin.SetSize((int)400,(int)400); cam1 = ren1.GetActiveCamera(); cam1.SetClippingRange((double)3.95297,(double)50); cam1.SetFocalPoint((double)9.71821,(double)0.458166,(double)29.3999); cam1.SetPosition((double)2.7439,(double)-37.3196,(double)38.7167); cam1.SetViewUp((double)-0.16123,(double)0.264271,(double)0.950876); iren.Initialize(); // render the image[] //[] // loop over surfaces[] i = 0; while((i) < 17) { cf.SetValue((int)0,(double)min+(i/16.0)*(max-min)); renWin.Render(); i = i + 1; } cf.SetValue((int)0,(double)min+(0.2)*(max-min)); renWin.Render(); // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
///<summary> A Set Method for Static Variables </summary> public static void Setpl3d(vtkPLOT3DReader toSet) { pl3d = toSet; }
///<summary> A Set Method for Static Variables </summary> public static void SetPlot3D0(vtkPLOT3DReader toSet) { Plot3D0 = toSet; }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVcombStreamers2(String [] argv) { //Prefix Content is: "" // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // create pipeline[] //[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin"); pl3d.SetScalarFunctionNumber((int)100); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); ps = new vtkPlaneSource(); ps.SetXResolution((int)4); ps.SetYResolution((int)4); ps.SetOrigin((double)2,(double)-2,(double)26); ps.SetPoint1((double)2,(double)2,(double)26); ps.SetPoint2((double)2,(double)-2,(double)32); psMapper = vtkPolyDataMapper.New(); psMapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort()); psActor = new vtkActor(); psActor.SetMapper((vtkMapper)psMapper); psActor.GetProperty().SetRepresentationToWireframe(); streamer = new vtkDashedStreamLine(); streamer.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); streamer.SetSource((vtkDataSet)ps.GetOutput()); streamer.SetMaximumPropagationTime((double)100); streamer.SetIntegrationStepLength((double).2); streamer.SetStepLength((double).001); streamer.SetNumberOfThreads((int)1); streamer.SetIntegrationDirectionToForward(); streamMapper = vtkPolyDataMapper.New(); streamMapper.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort()); streamMapper.SetScalarRange( (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); streamline = new vtkActor(); streamline.SetMapper((vtkMapper)streamMapper); outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); // Add the actors to the renderer, set the background and size[] //[] ren1.AddActor((vtkProp)psActor); ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)streamline); ren1.SetBackground((double)1,(double)1,(double)1); renWin.SetSize((int)300,(int)300); ren1.SetBackground((double)0.1,(double)0.2,(double)0.4); cam1 = ren1.GetActiveCamera(); cam1.SetClippingRange((double)3.95297,(double)50); cam1.SetFocalPoint((double)9.71821,(double)0.458166,(double)29.3999); cam1.SetPosition((double)2.7439,(double)-37.3196,(double)38.7167); cam1.SetViewUp((double)-0.16123,(double)0.264271,(double)0.950876); // render the image[] //[] renWin.Render(); // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVtextureThreshold(String [] argv) { //Prefix Content is: "" // Create the RenderWindow, Renderer and both Actors[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // read data[] //[] pl3d = new vtkPLOT3DReader(); pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinxyz.bin"); pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/bluntfinq.bin"); pl3d.SetScalarFunctionNumber((int)100); pl3d.SetVectorFunctionNumber((int)202); pl3d.Update(); // wall[] //[] wall = new vtkStructuredGridGeometryFilter(); wall.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); wall.SetExtent((int)0,(int)100,(int)0,(int)0,(int)0,(int)100); wallMap = vtkPolyDataMapper.New(); wallMap.SetInputConnection((vtkAlgorithmOutput)wall.GetOutputPort()); wallMap.ScalarVisibilityOff(); wallActor = new vtkActor(); wallActor.SetMapper((vtkMapper)wallMap); wallActor.GetProperty().SetColor((double)0.8,(double)0.8,(double)0.8); // fin[] // [] fin = new vtkStructuredGridGeometryFilter(); fin.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); fin.SetExtent((int)0,(int)100,(int)0,(int)100,(int)0,(int)0); finMap = vtkPolyDataMapper.New(); finMap.SetInputConnection((vtkAlgorithmOutput)fin.GetOutputPort()); finMap.ScalarVisibilityOff(); finActor = new vtkActor(); finActor.SetMapper((vtkMapper)finMap); finActor.GetProperty().SetColor((double)0.8,(double)0.8,(double)0.8); // planes to threshold[] tmap = new vtkStructuredPointsReader(); tmap.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/texThres2.vtk"); texture = new vtkTexture(); texture.SetInputConnection((vtkAlgorithmOutput)tmap.GetOutputPort()); texture.InterpolateOff(); texture.RepeatOff(); plane1 = new vtkStructuredGridGeometryFilter(); plane1.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); plane1.SetExtent((int)10,(int)10,(int)0,(int)100,(int)0,(int)100); thresh1 = new vtkThresholdTextureCoords(); thresh1.SetInputConnection((vtkAlgorithmOutput)plane1.GetOutputPort()); thresh1.ThresholdByUpper((double)1.5); plane1Map = new vtkDataSetMapper(); plane1Map.SetInputConnection((vtkAlgorithmOutput)thresh1.GetOutputPort()); plane1Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); plane1Actor = new vtkActor(); plane1Actor.SetMapper((vtkMapper)plane1Map); plane1Actor.SetTexture((vtkTexture)texture); plane1Actor.GetProperty().SetOpacity((double)0.999); plane2 = new vtkStructuredGridGeometryFilter(); plane2.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); plane2.SetExtent((int)30,(int)30,(int)0,(int)100,(int)0,(int)100); thresh2 = new vtkThresholdTextureCoords(); thresh2.SetInputConnection((vtkAlgorithmOutput)plane2.GetOutputPort()); thresh2.ThresholdByLower((double)1.5); plane2Map = new vtkDataSetMapper(); plane2Map.SetInputConnection((vtkAlgorithmOutput)thresh2.GetOutputPort()); plane2Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); plane2Actor = new vtkActor(); plane2Actor.SetMapper((vtkMapper)plane2Map); plane2Actor.SetTexture((vtkTexture)texture); plane2Actor.GetProperty().SetOpacity((double)0.999); plane3 = new vtkStructuredGridGeometryFilter(); plane3.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); plane3.SetExtent((int)35,(int)35,(int)0,(int)100,(int)0,(int)100); thresh3 = new vtkThresholdTextureCoords(); thresh3.SetInputConnection((vtkAlgorithmOutput)plane3.GetOutputPort()); thresh3.ThresholdBetween((double)1.5,(double)1.8); plane3Map = new vtkDataSetMapper(); plane3Map.SetInputConnection((vtkAlgorithmOutput)thresh3.GetOutputPort()); plane3Map.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0], (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]); plane3Actor = new vtkActor(); plane3Actor.SetMapper((vtkMapper)plane3Map); plane3Actor.SetTexture((vtkTexture)texture); plane3Actor.GetProperty().SetOpacity((double)0.999); // outline[] outline = new vtkStructuredGridOutlineFilter(); outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort()); outlineMapper = vtkPolyDataMapper.New(); outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort()); outlineActor = new vtkActor(); outlineActor.SetMapper((vtkMapper)outlineMapper); outlineProp = outlineActor.GetProperty(); outlineProp.SetColor((double)0,(double)0,(double)0); // Add the actors to the renderer, set the background and size[] //[] ren1.AddActor((vtkProp)outlineActor); ren1.AddActor((vtkProp)wallActor); ren1.AddActor((vtkProp)finActor); ren1.AddActor((vtkProp)plane1Actor); ren1.AddActor((vtkProp)plane2Actor); ren1.AddActor((vtkProp)plane3Actor); ren1.SetBackground((double)1,(double)1,(double)1); renWin.SetSize((int)256,(int)256); cam1 = new vtkCamera(); cam1.SetClippingRange((double)1.51176,(double)75.5879); cam1.SetFocalPoint((double)2.33749,(double)2.96739,(double)3.61023); cam1.SetPosition((double)10.8787,(double)5.27346,(double)15.8687); cam1.SetViewAngle((double)30); cam1.SetViewUp((double)-0.0610856,(double)0.987798,(double)-0.143262); ren1.SetActiveCamera((vtkCamera)cam1); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }