static void Main() { string VTK_DATA_ROOT = "C:/Program Files/VTKData"; // Create a vtkBYUReader and read in a data set. vtkBYUReader fohe = new vtkBYUReader(); fohe.SetGeometryFileName(VTK_DATA_ROOT + "/Data/teapot.g"); // Create a vtkPolyDataNormals filter to calculate the normals of the // data set. vtkPolyDataNormals normals = new vtkPolyDataNormals(); normals.SetInputConnection(fohe.GetOutputPort()); // Set up the associated mapper and actor. vtkPolyDataMapper foheMapper = new vtkPolyDataMapper(); foheMapper.SetInputConnection(normals.GetOutputPort()); vtkLODActor foheActor = new vtkLODActor(); foheActor.SetMapper(foheMapper); // Create a vtkOutlineFilter to draw the bounding box of the data set. // Also create the associated mapper and actor. vtkOutlineFilter outline = new vtkOutlineFilter(); outline.SetInputConnection(normals.GetOutputPort()); vtkPolyDataMapper mapOutline = new vtkPolyDataMapper(); mapOutline.SetInputConnection(outline.GetOutputPort()); vtkActor outlineActor = new vtkActor(); outlineActor.SetMapper(mapOutline); outlineActor.GetProperty().SetColor(0, 0, 0); // Create a vtkCamera, and set the camera parameters. vtkCamera camera = new vtkCamera(); camera.SetClippingRange(1.60187, 20.0842); camera.SetFocalPoint(0.21406, 1.5, 0); camera.SetPosition(8.3761, 4.94858, 4.12505); camera.SetViewUp(0.180325, 0.549245, -0.815974); // Create a vtkLight, and set the light parameters. vtkLight light = new vtkLight(); light.SetFocalPoint(0.21406, 1.5, 0); light.SetPosition(8.3761, 4.94858, 4.12505); // Create the Renderers. Assign them the appropriate viewport // coordinates, active camera, and light. vtkRenderer ren = new vtkRenderer(); ren.SetViewport(0, 0, 0.5, 1.0); ren.SetActiveCamera(camera); ren.AddLight(light); vtkRenderer ren2 = new vtkRenderer(); ren2.SetViewport(0.5, 0, 1.0, 1.0); ren2.SetActiveCamera(camera); ren2.AddLight(light); // Create the RenderWindow and RenderWindowInteractor. vtkRenderWindow renWin = new vtkRenderWindow(); renWin.AddRenderer(ren); renWin.AddRenderer(ren2); renWin.SetWindowName("VTK - Cube Axes"); renWin.SetSize(600, 300); vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow(renWin); // Add the actors to the renderer, and set the background. ren.AddViewProp(foheActor); ren.AddViewProp(outlineActor); ren2.AddViewProp(foheActor); ren2.AddViewProp(outlineActor); ren.SetBackground(0.1, 0.2, 0.4); ren2.SetBackground(0.1, 0.2, 0.4); // Create a text property for both cube axes vtkTextProperty tprop = new vtkTextProperty(); tprop.SetColor(1, 1, 1); tprop.ShadowOn(); // Create a vtkCubeAxesActor2D. Use the outer edges of the bounding box to // draw the axes. Add the actor to the renderer. vtkCubeAxesActor2D axes = new vtkCubeAxesActor2D(); axes.SetInput(normals.GetOutput()); axes.SetCamera(ren.GetActiveCamera()); axes.SetLabelFormat("%6.4g"); axes.SetFlyModeToOuterEdges(); axes.SetFontFactor(0.8); axes.SetAxisTitleTextProperty(tprop); axes.SetAxisLabelTextProperty(tprop); ren.AddViewProp(axes); // Create a vtkCubeAxesActor2D. Use the closest vertex to the camera to // determine where to draw the axes. Add the actor to the renderer. vtkCubeAxesActor2D axes2 = new vtkCubeAxesActor2D(); axes2.SetViewProp(foheActor); axes2.SetCamera(ren2.GetActiveCamera()); axes2.SetLabelFormat("%6.4g"); axes2.SetFlyModeToClosestTriad(); axes2.SetFontFactor(0.8); axes2.ScalingOff(); axes2.SetAxisTitleTextProperty(tprop); axes2.SetAxisLabelTextProperty(tprop); ren2.AddViewProp(axes2); renWin.AddObserver((uint) EventIds.AbortCheckEvent, CheckAbort); iren.Initialize(); renWin.Render(); iren.Start(); vtkWin32OpenGLRenderWindow win32win = vtkWin32OpenGLRenderWindow.SafeDownCast(renWin); if (null != win32win) win32win.Clean(); }
/// <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(); renWin.SetMultiSamples(0); 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 vtkMultiBlockPLOT3DReader(); 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)].SetInputData((vtkDataSet)pl3d[getArrayIndex(vectorFunction)].GetOutput().GetBlock(0)); 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 = ((vtkDataSet)pl3d[getArrayIndex(vectorFunction)].GetOutput().GetBlock(0)).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> /// 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(); renWin.SetMultiSamples(0); 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 vtkMultiBlockPLOT3DReader(); 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)].SetInputData((vtkDataSet)pl3d[getArrayIndex(scalarFunction)].GetOutput().GetBlock(0)); 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().GetBlock(0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)pl3d[getArrayIndex(scalarFunction)].GetOutput().GetBlock(0)).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> /// An example that does not use a Windows Form /// </summary> /// <param name="argv"></param> public static void Main(String[] argv) { // This example demonstrates the use of vtkCubeAxesActor2D to indicate the // position in space that the camera is currently viewing. // The vtkCubeAxesActor2D draws axes on the bounding box of the data set and // labels the axes with x-y-z coordinates. // // First we include the VTK Tcl packages which will make available // all of the vtk commands to Tcl // // Create a vtkBYUReader and read in a data set. // fohe = vtkBYUReader.New(); fohe.SetGeometryFileName("../../../teapot.g"); // Create a vtkPolyDataNormals filter to calculate the normals of the data set. normals = vtkPolyDataNormals.New(); normals.SetInputConnection(fohe.GetOutputPort()); // Set up the associated mapper and actor. foheMapper = vtkPolyDataMapper.New(); foheMapper.SetInputConnection(normals.GetOutputPort()); foheActor = vtkLODActor.New(); foheActor.SetMapper(foheMapper); // Create a vtkOutlineFilter to draw the bounding box of the data set. Also // create the associated mapper and actor. outline = vtkOutlineFilter.New(); outline.SetInputConnection(normals.GetOutputPort()); mapOutline = vtkPolyDataMapper.New(); mapOutline.SetInputConnection(outline.GetOutputPort()); outlineActor = vtkActor.New(); outlineActor.SetMapper(mapOutline); outlineActor.GetProperty().SetColor(0, 0, 0); // Create a vtkCamera, and set the camera parameters. camera = vtkCamera.New(); camera.SetClippingRange(1.60187, 20.0842); camera.SetFocalPoint(0.21406, 1.5, 0); camera.SetPosition(8.3761, 4.94858, 4.12505); camera.SetViewUp(0.180325, 0.549245, -0.815974); // Create a vtkLight, and set the light parameters. light = vtkLight.New(); light.SetFocalPoint(0.21406, 1.5, 0); light.SetPosition(8.3761, 4.94858, 4.12505); // Create the Renderers. Assign them the appropriate viewport coordinates, // active camera, and light. ren1 = vtkRenderer.New(); ren1.SetViewport(0, 0, 0.5, 1.0); ren1.SetActiveCamera(camera); ren1.AddLight(light); ren2 = vtkRenderer.New(); ren2.SetViewport(0.5, 0, 1.0, 1.0); ren2.SetActiveCamera(camera); ren2.AddLight(light); // Create the RenderWindow and RenderWindowInteractor. renWin = vtkRenderWindow.New(); renWin.AddRenderer(ren1); renWin.AddRenderer(ren2); renWin.SetWindowName("VTK - Cube Axes"); renWin.SetSize(600, 300); iren = vtkRenderWindowInteractor.New(); iren.SetRenderWindow(renWin); // Add the actors to the renderer, and set the background. ren1.AddViewProp(foheActor); ren1.AddViewProp(outlineActor); ren2.AddViewProp(foheActor); ren2.AddViewProp(outlineActor); ren1.SetBackground(0.1, 0.2, 0.4); ren2.SetBackground(0.1, 0.2, 0.4); // Create a text property for both cube axes tprop = vtkTextProperty.New(); tprop.SetColor(1, 1, 1); tprop.ShadowOn(); // Create a vtkCubeAxesActor2D. Use the outer edges of the bounding box to // draw the axes. Add the actor to the renderer. axes = vtkCubeAxesActor2D.New(); axes.SetInput(normals.GetOutput()); axes.SetCamera(ren1.GetActiveCamera()); axes.SetLabelFormat("%6.4g"); axes.SetFlyModeToOuterEdges(); axes.SetFontFactor(0.8); axes.SetAxisTitleTextProperty(tprop); axes.SetAxisLabelTextProperty(tprop); ren1.AddViewProp(axes); // Create a vtkCubeAxesActor2D. Use the closest vertex to the camera to // determine where to draw the axes. Add the actor to the renderer. axes2 = vtkCubeAxesActor2D.New(); axes2.SetViewProp(foheActor); axes2.SetCamera(ren2.GetActiveCamera()); axes2.SetLabelFormat("%6.4g"); axes2.SetFlyModeToClosestTriad(); axes2.SetFontFactor(0.8); axes2.ScalingOff(); axes2.SetAxisTitleTextProperty(tprop); axes2.SetAxisLabelTextProperty(tprop); ren2.AddViewProp(axes2); // Render renWin.Render(); // Set the user method (bound to key 'u') iren.Initialize(); iren.Start(); // Set up a check for aborting rendering. renWin.AbortCheckEvt += new vtkObject.vtkObjectEventHandler(TkCheckAbort); //Clean Up 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(); }