Exemplo n.º 1
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVEnSightOfficeBin(String [] argv)
    {
        //Prefix Content is: ""

          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // read data[]
          //[]
          reader = new vtkGenericEnSightReader();
          // Make sure all algorithms use the composite data pipeline[]
          cdp = new vtkCompositeDataPipeline();
          vtkGenericEnSightReader.SetDefaultExecutivePrototype((vtkExecutive)cdp);
          reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/office_bin.case");
          reader.Update();
          // to add coverage for vtkOnePieceExtentTranslator[]
          translator = new vtkOnePieceExtentTranslator();
          vtkStreamingDemandDrivenPipeline.SetExtentTranslator(reader.GetOutputInformation(0), (vtkExtentTranslator)translator);
          outline = new vtkStructuredGridOutlineFilter();
          //    outline SetInputConnection [reader GetOutputPort][]
          outline.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          mapOutline = vtkPolyDataMapper.New();
          mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)mapOutline);
          outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          // Create source for streamtubes[]
          streamer = new vtkStreamPoints();
          //    streamer SetInputConnection [reader GetOutputPort][]
          streamer.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          streamer.SetStartPosition((double)0.1,(double)2.1,(double)0.5);
          streamer.SetMaximumPropagationTime((double)500);
          streamer.SetTimeIncrement((double)0.5);
          streamer.SetIntegrationDirectionToForward();
          cone = new vtkConeSource();
          cone.SetResolution((int)8);
          cones = new vtkGlyph3D();
          cones.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          cones.SetSourceConnection(cone.GetOutputPort());
          cones.SetScaleFactor((double)0.9);
          cones.SetScaleModeToScaleByVector();
          mapCones = vtkPolyDataMapper.New();
          mapCones.SetInputConnection((vtkAlgorithmOutput)cones.GetOutputPort());
          //    eval mapCones SetScalarRange [[reader GetOutput] GetScalarRange][]
          mapCones.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[0],
          (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[1]);
          conesActor = new vtkActor();
          conesActor.SetMapper((vtkMapper)mapCones);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)conesActor);
          ren1.SetBackground((double)0.4,(double)0.4,(double)0.5);
          renWin.SetSize((int)300,(int)300);
          iren.Initialize();
          // interact with data[]
          vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);

        //deleteAllVTKObjects();
    }
        private void vtkPolyDataConnectivityFilter_LargestRegion()
        {
            // Small sphere
            vtkSphereSource sphereSource1 = vtkSphereSource.New();

            sphereSource1.Update();

            // Large sphere
            vtkSphereSource sphereSource2 = vtkSphereSource.New();

            sphereSource2.SetRadius(10);
            sphereSource2.SetCenter(25, 0, 0);
            sphereSource2.SetThetaResolution(10);
            sphereSource2.SetPhiResolution(10);
            sphereSource2.Update();

            vtkAppendPolyData appendFilter = vtkAppendPolyData.New();

            appendFilter.AddInputConnection(sphereSource1.GetOutputPort());
            appendFilter.AddInputConnection(sphereSource2.GetOutputPort());
            appendFilter.Update();

            vtkPolyDataConnectivityFilter connectivityFilter = vtkPolyDataConnectivityFilter.New();

            connectivityFilter.SetInputConnection(appendFilter.GetOutputPort());
            connectivityFilter.SetExtractionModeToLargestRegion();
            connectivityFilter.Update();

            // Create a mapper and actor for original data
            vtkPolyDataMapper originalMapper = vtkPolyDataMapper.New();

            originalMapper.SetInputConnection(appendFilter.GetOutputPort());
            originalMapper.Update();

            vtkActor originalActor = vtkActor.New();

            originalActor.SetMapper(originalMapper);

            // Create a mapper and actor for extracted data
            vtkPolyDataMapper extractedMapper = vtkPolyDataMapper.New();

            extractedMapper.SetInputConnection(connectivityFilter.GetOutputPort());
            extractedMapper.Update();

            vtkActor extractedActor = vtkActor.New();

            extractedActor.GetProperty().SetColor(1, 0, 0);
            extractedActor.SetMapper(extractedMapper);
            // get a reference to the renderwindow of our renderWindowControl1
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            // renderer
            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();

            // set background color
            renderer.SetBackground(0.2, 0.3, 0.4);
            // add our actor to the renderer
            renderer.AddActor(originalActor);
            renderer.AddActor(extractedActor);
        }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVEnSightOfficeASCII(String [] argv)
    {
        //Prefix Content is: ""

        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        // read data[]
        //[]
        reader = new vtkGenericEnSightReader();
        // Make sure all algorithms use the composite data pipeline[]
        cdp = new vtkCompositeDataPipeline();
        vtkGenericEnSightReader.SetDefaultExecutivePrototype((vtkExecutive)cdp);
        reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/office_ascii.case");
        reader.Update();
        // to add coverage for vtkOnePieceExtentTranslator[]
        translator = new vtkOnePieceExtentTranslator();
        vtkStreamingDemandDrivenPipeline.SetExtentTranslator(reader.GetOutputInformation(0), (vtkExtentTranslator)translator);
        outline = new vtkStructuredGridOutlineFilter();
        //    outline SetInputConnection [reader GetOutputPort][]
        outline.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
        mapOutline = vtkPolyDataMapper.New();
        mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)mapOutline);
        outlineActor.GetProperty().SetColor((double)0, (double)0, (double)0);
        // Create source for streamtubes[]
        streamer = new vtkStreamPoints();
        //    streamer SetInputConnection [reader GetOutputPort][]
        streamer.SetInputData((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
        streamer.SetStartPosition((double)0.1, (double)2.1, (double)0.5);
        streamer.SetMaximumPropagationTime((double)500);
        streamer.SetTimeIncrement((double)0.5);
        streamer.SetIntegrationDirectionToForward();
        cone = new vtkConeSource();
        cone.SetResolution((int)8);
        cones = new vtkGlyph3D();
        cones.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
        cones.SetSourceConnection(cone.GetOutputPort());
        cones.SetScaleFactor((double)0.9);
        cones.SetScaleModeToScaleByVector();
        mapCones = vtkPolyDataMapper.New();
        mapCones.SetInputConnection((vtkAlgorithmOutput)cones.GetOutputPort());
        //    eval mapCones SetScalarRange [[reader GetOutput] GetScalarRange][]
        mapCones.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[0], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetScalarRange()[1]);
        conesActor = new vtkActor();
        conesActor.SetMapper((vtkMapper)mapCones);
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)conesActor);
        ren1.SetBackground((double)0.4, (double)0.4, (double)0.5);
        renWin.SetSize((int)300, (int)300);
        iren.Initialize();
        // interact with data[]
        vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);

//deleteAllVTKObjects();
    }
Exemplo n.º 4
0
        void RenderSlicer()
        {
            //Create all the objects for the pipeline
            vtkXMLImageDataReader reader  = vtkXMLImageDataReader.New();
            vtkImageActor         iactor  = vtkImageActor.New();
            vtkImageClip          clip    = vtkImageClip.New();
            vtkContourFilter      contour = vtkContourFilter.New();
            vtkPolyDataMapper     mapper  = vtkPolyDataMapper.New();
            vtkActor actor = vtkActor.New();
            vtkInteractorStyleImage style = vtkInteractorStyleImage.New();

            vtkRenderer renderer = renderWindowControl2.RenderWindow.GetRenderers().GetFirstRenderer();

            //Read the Image
            reader.SetFileName(m_FileName);

            //Go through the visulization pipeline
            iactor.SetInput(reader.GetOutput());
            renderer.AddActor(iactor);
            reader.Update();
            int[] extent = reader.GetOutput().GetWholeExtent();
            iactor.SetDisplayExtent(extent[0], extent[1], extent[2], extent[3],
                                    (extent[4] + extent[5]) / 2,
                                    (extent[4] + extent[5]) / 2);

            clip.SetInputConnection(reader.GetOutputPort());
            clip.SetOutputWholeExtent(extent[0], extent[1], extent[2], extent[3],
                                      (extent[4] + extent[5]) / 2,
                                      (extent[4] + extent[5]) / 2);

            contour.SetInputConnection(clip.GetOutputPort());
            contour.SetValue(0, 100);

            mapper.SetInputConnection(contour.GetOutputPort());
            mapper.SetScalarVisibility(1);

            //Go through the graphics pipeline
            actor.SetMapper(mapper);
            actor.GetProperty().SetColor(0, 1, 0);

            renderer.AddActor(actor);

            //Give a new style to the interactor
            //vtkRenderWindowInteractor iren = renderWindowControl2.RenderWindow.GetInteractor();
            //iren.SetInteractorStyle(style);


            //Update global variables
            this.trackBar1.Maximum = extent[5];
            this.trackBar1.Minimum = extent[4];
            //this.Interactor = iren;
            this.m_SliceRenderWindow = renderWindowControl2.RenderWindow;
            this.m_SliceRenderer     = renderer;
            this.m_SliceClip         = clip;
            this.m_SliceImageActor   = iactor;

            renderer.ResetCamera();
        }
        private void DijkstraGraphGeodesicPath()
        {
            // Create a sphere
            vtkSphereSource sphereSource = vtkSphereSource.New();

            sphereSource.Update();

            vtkDijkstraGraphGeodesicPath dijkstra = vtkDijkstraGraphGeodesicPath.New();

            dijkstra.SetInputConnection(sphereSource.GetOutputPort());
            dijkstra.SetStartVertex(0);
            dijkstra.SetEndVertex(10);
            dijkstra.Update();

            // Create a mapper and actor
            vtkPolyDataMapper pathMapper = vtkPolyDataMapper.New();

            pathMapper.SetInputConnection(dijkstra.GetOutputPort());

            vtkActor pathActor = vtkActor.New();

            pathActor.SetMapper(pathMapper);
            pathActor.GetProperty().SetColor(1, 0, 0); // Red
            pathActor.GetProperty().SetLineWidth(4);

            // Create a mapper and actor
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(sphereSource.GetOutputPort());

            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);

            // get a reference to the renderwindow of our renderWindowControl1
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            // renderer
            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();

            // set background color
            renderer.SetBackground(0.3, 0.6, 0.3);
            // add our actor to the renderer
            renderer.AddActor(actor);
            renderer.AddActor(pathActor);
        }
Exemplo n.º 6
0
        static private void init()
        {
            vtkSTLReader rdr = vtkSTLReader.New();

            rdr.SetFileName("BODY-EXTRUDEUR-WADE.stl");



            // Créer une géométrie sphérique

            /*vtkSphereSource sphere = vtkSphereSource.New();
             * sphere.SetRadius(1.0);
             * sphere.SetThetaResolution(18);
             * sphere.SetPhiResolution(18);*/

            // Transforme la géométrie en primitives graphiques (OpenGL dans notre cas)
            vtkPolyDataMapper map = vtkPolyDataMapper.New();

            map.SetInput(rdr.GetOutput());

            // L'acteur représente l'entitée géométrique.
            // Il permet de définir sa position, son orientation, sa couleur, etc.
            vtkActor aSphere = new vtkActor();

            aSphere.SetMapper(map);
            aSphere.GetProperty().SetColor(0.8, 0.8, 0.8); // color blue

            // Nous créons un renderer qui va faire le rendu de notre entitée.
            vtkRenderer ren1 = vtkRenderer.New();

            ren1.AddActor(aSphere);
            ren1.SetBackground(1, 1, 1); // background color white

            // Nous créons une fenêtre de rendu
            vtkRenderWindow renWin = vtkRenderWindow.New();

            renWin.AddRenderer(ren1);
            renWin.SetSize(300, 300);

            // Nous créons un interactor qui permet de bouger la caméra.
            vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();

            iren.SetRenderWindow(renWin);

            // Nous lançons le rendu et l'interaction
            renWin.Render();
            iren.Start();


            ////// CLEANUP ///////
            rdr.Dispose();
            map.Dispose();
            aSphere.Dispose();
            ren1.Dispose();
            renWin.Dispose();
            iren.Dispose();
        }
Exemplo n.º 7
0
        private void Hexahedron()
        {
            // Setup the coordinates of eight points
            // (faces must be in counter clockwise order as viewed from the outside)
            double[,] p = new double[, ] {
                { 0.0, 0.0, 0.0 },
                { 1.0, 0.0, 0.0 },
                { 1.0, 1.0, 0.0 },
                { 0.0, 1.0, 0.0 },
                { 0.0, 0.0, 1.0 },
                { 1.0, 0.0, 1.0 },
                { 1.0, 1.0, 1.0 },
                { 0.0, 1.0, 1.0 }
            };

            // Create the points
            vtkPoints points = vtkPoints.New();

            for (int i = 0; i < 8; i++)
            {
                points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);
            }

            // Create a hexahedron from the points
            vtkHexahedron hex = vtkHexahedron.New();

            for (int i = 0; i < 8; i++)
            {
                hex.GetPointIds().SetId(i, i);
            }

            // Add the hexahedron to a cell array
            vtkCellArray hexs = vtkCellArray.New();

            hexs.InsertNextCell(hex);

            // Add the points and hexahedron to an unstructured grid
            vtkUnstructuredGrid uGrid = vtkUnstructuredGrid.New();

            uGrid.SetPoints(points);
            uGrid.InsertNextCell(hex.GetCellType(), hex.GetPointIds());

            // Visualize
            vtkDataSetMapper mapper = vtkDataSetMapper.New();

            mapper.SetInput(uGrid);
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetLineWidth(4);
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            vtkRenderer     renderer     = renderWindow.GetRenderers().GetFirstRenderer();

            renderer.SetBackground(0.2, 0.3, 0.4);
            renderer.AddActor(actor);
            renderer.ResetCamera();
        }
Exemplo n.º 8
0
        private void GreedyTerrainDecimation()
        {
            // Create an image
            vtkImageData image = vtkImageData.New();

            image.SetDimensions(3, 3, 1);
            image.SetNumberOfScalarComponents(1);
            image.SetScalarTypeToUnsignedChar();
            int[] dims = image.GetDimensions();
            unsafe {
                for (int i = 0; i < dims[0]; i++)
                {
                    for (int j = 0; j < dims[1]; j++)
                    {
                        byte *ptr = (byte *)image.GetScalarPointer(i, j, 0);
                        *     ptr = (byte)vtkMath.Round(vtkMath.Random(0, 1));
                    }
                }
            }
            vtkGreedyTerrainDecimation decimation = vtkGreedyTerrainDecimation.New();

            decimation.SetInputConnection(image.GetProducerPort());
            decimation.Update();
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(decimation.GetOutputPort());
            // actor
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetInterpolationToFlat();
            actor.GetProperty().EdgeVisibilityOn();
            actor.GetProperty().SetEdgeColor(1, 0, 0);

            // get a reference to the renderwindow of our renderWindowControl1
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            // renderer
            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();

            // set background color
            renderer.SetBackground(0.2, 0.3, 0.4);
            // add our actor to the renderer
            renderer.AddActor(actor);
        }
Exemplo n.º 9
0
Arquivo: Part.cs Projeto: ovevans/STAN
        /// <summary>
        /// Create new VTK structure of Part:
        /// <br> Points -> Grid -> Mapper -> Actor </br>
        /// </summary>
        public void CreatePart(Dictionary <int, Node> NodeLib, Dictionary <int, Element> ElemLib)
        {
            // Catch nodes - only used by Part
            Nodes = DetectPartNodes(ElemLib);

            // Initialize Elements - to connect vtkCells with Element IDs (and therefore scalar/result value)
            Elements = new List <int>();

            // Initialize VTK data
            Points = vtkPoints.New();
            Grid   = vtkUnstructuredGrid.New();
            Mapper = vtkDataSetMapper.New();
            Actor  = vtkActor.New();
            Edges  = vtkActor.New();
            Faces  = vtkPolyData.New();
            Filter = vtkDataSetSurfaceFilter.New();

            // Insert Points
            foreach (int n in Nodes.Keys)
            {
                Points.InsertNextPoint(NodeLib[n].X, NodeLib[n].Y, NodeLib[n].Z);
            }

            Grid.SetPoints(Points);      // Add points to Grid
            CreateMesh(ElemLib);         // Create Mesh grid

            // Add Grid to Mapper
            Mapper.SetInput(Grid);
            Mapper.SetScalarModeToUseCellData();
            Mapper.ScalarVisibilityOff();
            Mapper.InterpolateScalarsBeforeMappingOn();
            Mapper.Update();

            Actor.SetMapper(Mapper);                        // Add Mapper to Actor
            Actor.GetProperty().SetEdgeVisibility(1);       // Enable wireframe display mode
            Actor.GetProperty().SetLineWidth((float)0.5);   // Set wireframe line thickness
            // Set Actor default color
            ColorID = ID % 13;
            SetColor(ColorID);

            // Outer features
            ExtractFeatures();
        }
Exemplo n.º 10
0
        public XmlPolyDataPackage(string vtpFile, vtkRenderer renderer)
        {
            //Console.WriteLine(string.Format("VTP文件 = {0}", vtpFile));

            if (File.Exists(vtpFile))
            {
                if (vtpFile.EndsWith(".vtp"))
                {
                    //Console.WriteLine(string.Format("VTP文件 = {0}已存在", vtpFile));
                    reader = vtkXMLPolyDataReader.New();
                    reader.SetFileName(vtpFile);
                    reader.Update();

                    PolyData = reader.GetOutput();
                }
                else if (vtpFile.EndsWith(".stl"))
                {
                    PolyData = VTKUtil.ReadSTLPolyData(vtpFile);
                }

                vtkCamera camera = vtkCamera.New();

                var sortPolydata = new vtkDepthSortPolyData();
                sortPolydata.SetInput(PolyData);
                sortPolydata.SetCamera(camera);
                sortPolydata.SetDirectionToFrontToBack();
                sortPolydata.SetVector(1, 1, 1);
                sortPolydata.SetSortScalars(1);
                sortPolydata.Update();

                _polyDataMapper = vtkPolyDataMapper.New();
                _polyDataMapper.ScalarVisibilityOff();
                _polyDataMapper.SetInput(sortPolydata.GetOutput());
                _polyDataMapper.Update();

                actor = vtkActor.New();
                actor.SetMapper(_polyDataMapper);
                actor.GetProperty().SetColor(1, 1, 1);

                //marchingCubeActor.GetProperty().BackfaceCullingOn();
                //marchingCubeActor.GetProperty().FrontfaceCullingOn();
                //marchingCubeActor.GetProperty().BackfaceCullingOff();

                // now, tell the renderer our actors
                renderer.AddActor(actor);

                this.renderer = renderer;
            }
            else
            {
                throw new Exception(string.Format("VTP文件 = {0}不存在。", vtpFile));
            }

            //正面观();
        }
Exemplo n.º 11
0
        private void DrawTriangle()
        {
            //创建点数据
            vtkPoints points = vtkPoints.New();

            points.InsertNextPoint(1.0, 0.0, 0.0);
            points.InsertNextPoint(0.0, 1.0, 0.0);
            points.InsertNextPoint(0.0, 0.0, 0.0);

            //每两个坐标之间分别创建一条线
            //SetId()的第一个参数是线段的端点ID,第二参数是连接的的点的ID
            vtkLine line0 = vtkLine.New();

            line0.GetPointIds().SetId(0, 0);
            line0.GetPointIds().SetId(1, 1);

            vtkLine line1 = vtkLine.New();

            line1.GetPointIds().SetId(0, 1);
            line1.GetPointIds().SetId(1, 2);

            vtkLine line2 = vtkLine.New();

            line2.GetPointIds().SetId(0, 2);
            line2.GetPointIds().SetId(1, 0);

            //创建单元数组,用于存储以上创建的线段
            vtkCellArray lines = vtkCellArray.New();

            lines.InsertNextCell(line0);
            lines.InsertNextCell(line1);
            lines.InsertNextCell(line2);

            //将点和线加入数据集中,前者定义数据集的几何结构,后者定义拓扑结构
            //创建vtkPolyData类型的数据,是一种数据集
            vtkPolyData polyData = vtkPolyData.New();

            //将创建的点数据加入vtkPolyData数据里
            polyData.SetPoints(points); //点数据定义了polydata数据集的几何结构。
            polyData.SetLines(lines);   //定义拓扑结构

            //显示数据
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputData(polyData);
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetColor(1.0, 0.0, 0.0);
            vtkRenderWindow renWin   = myRenderWindowControl.RenderWindow;
            vtkRenderer     renderer = renWin.GetRenderers().GetFirstRenderer();

            renderer.SetBackground(1.0, 1.0, 1.0);
            renderer.AddActor(actor);
        }
Exemplo n.º 12
0
        private vtkActor DrawMapBar(Stop stop, string line)
        {
            if (stop.arrivalsByLine == null)
            {
                return(null);
            }
            if (!stop.arrivalsByLine.ContainsKey(line))
            {
                return(null);
            }

            float[] point = GetPointOnMap(stop.Location);
            float   z     = CalculateZ(stop.arrivalsByLine[line]) * 0.35f;

            vtkLineSource lineSource = new vtkLineSource();

            lineSource.SetPoint1(point[0], point[1], 0);
            lineSource.SetPoint2(point[0], point[1], z);

            vtkTubeFilter tubeSource = new vtkTubeFilter();

            tubeSource.SetInputConnection(lineSource.GetOutputPort());
            tubeSource.SetRadius(0.005);
            tubeSource.SetNumberOfSides(4);
            tubeSource.Update();

            vtkPolyDataMapper tubeMapper = vtkPolyDataMapper.New();

            tubeMapper.SetInputConnection(tubeSource.GetOutputPort());


            vtkActor actor = vtkActor.New();

            actor.GetProperty().SetOpacity(1);

            Color color = Color.GetColorFromPalette(z, 0, 0.35f);

            actor.GetProperty().SetColor(color.r, color.g, color.b);
            actor.SetMapper(tubeMapper);

            return(actor);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Crée le nécessaire pour l'affichage du volume
        /// </summary>
        private void createVolumeObjects()
        {
            _volumeMapper = vtkPolyDataMapper.New();
            _volumeMapper.SetInput(_stlReader.GetOutput());
            _volumeActor = vtkActor.New();

            //couleur du volume
            double[] rgb = colorToRGB(VolumeColor);
            _volumeActor.GetProperty().SetColor(rgb[0], rgb[1], rgb[2]);
            _volumeActor.SetMapper(_volumeMapper);
        }
Exemplo n.º 14
0
        private void LongLine()
        {
            // Create five points
            double[,] p = new double[, ] {
                { 0.0, 0.0, 0.0 },
                { 1.0, 0.0, 0.0 },
                { 0.0, 1.0, 0.0 },
                { 0.0, 1.0, 2.0 },
                { 1.0, 2.0, 3.0 }
            };

            // Create a vtkPoints object and store the points in it
            vtkPoints points = vtkPoints.New();

            for (int i = 0; i < 5; i++)
            {
                points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);
            }

            // Create a cell array to store the lines in and add the lines to it
            vtkCellArray lines = vtkCellArray.New();

            for (int i = 0; i < 4; i++)
            {
                vtkLine line = vtkLine.New();
                line.GetPointIds().SetId(0, i);
                line.GetPointIds().SetId(1, i + 1);
                lines.InsertNextCell(line);
            }

            // Create a polydata to store everything in
            vtkPolyData linesPolyData = vtkPolyData.New();

            // Add the points to the dataset
            linesPolyData.SetPoints(points);

            // Add the lines to the dataset
            linesPolyData.SetLines(lines);
            // Visualize
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInput(linesPolyData);
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetLineWidth(4);
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            vtkRenderer     renderer     = renderWindow.GetRenderers().GetFirstRenderer();

            renderer.SetBackground(0.2, 0.3, 0.4);
            renderer.AddActor(actor);
            renderer.ResetCamera();
        }
Exemplo n.º 15
0
        private void DrawPoint()
        {
            // Create the geometry of the points (the coordinate)
            vtkPoints points = vtkPoints.New();

            double[,] p = new double[, ]
            {
                { 1.0, 2.0, 3.0 },
                { 3.0, 1.0, 2.0 },
                { 2.0, 3.0, 1.0 },
                { 1.0, 3.0, 3.0 }
            };

            // Create topology of the points (a vertex per point)
            vtkCellArray vertices = vtkCellArray.New();
            int          nPts     = 4;

            int[] ids = new int[nPts];
            for (int i = 0; i < nPts; i++)
            {
                ids[i] = (int)points.InsertNextPoint(p[i, 0], p[i, 1], p[i, 2]);
            }

            int    size = Marshal.SizeOf(typeof(int)) * nPts;
            IntPtr pIds = Marshal.AllocHGlobal(size);

            Marshal.Copy(ids, 0, pIds, nPts);
            vertices.InsertNextCell(nPts, pIds);
            Marshal.FreeHGlobal(pIds);

            // Create a polydata object
            vtkPolyData pointPoly = vtkPolyData.New();

            // Set the points and vertices we created as the geometry and topology of the polydata
            pointPoly.SetPoints(points);
            pointPoly.SetVerts(vertices);

            // Visualize
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputData(pointPoly);

            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetPointSize(10);
            vtkRenderWindow renderWindow = myRenderWindowControl.RenderWindow;
            vtkRenderer     renderer     = renderWindow.GetRenderers().GetFirstRenderer();

            renderer.SetBackground(0.3, 0.2, 0.1);
            renderer.AddActor(actor);
        }
Exemplo n.º 16
0
        private void ParticleReader()
        {
            // Path to vtk data must be set as an environment variable
            // VTK_DATA_ROOT = "C:\VTK\vtkdata-5.8.0"
            vtkTesting test     = vtkTesting.New();
            string     root     = test.GetDataRoot();
            string     filePath = System.IO.Path.Combine(root, @"Data\Particles.raw");

            // Read the file
            vtkParticleReader reader = vtkParticleReader.New();

            reader.SetFileName(filePath);
            reader.SetDataByteOrderToBigEndian();
            reader.Update();
            Debug.WriteLine("NumberOfPieces: " + reader.GetOutput().GetNumberOfPieces());

            // Visualize
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(reader.GetOutputPort());
            mapper.SetScalarRange(4, 9);
            mapper.SetPiece(1);

            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetPointSize(4);
            actor.GetProperty().SetColor(1, 0, 0);
            // get a reference to the renderwindow of our renderWindowControl1
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            // renderer
            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();

            // set background color
            renderer.SetBackground(0.2, 0.3, 0.4);
            // add our actor to the renderer
            renderer.AddActor(actor);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Crée le nécessaire pour l'affichage des  arêtes
        /// </summary>
        private void createEdgeObjects()
        {
            _edgeExtractor = vtkExtractEdges.New();
            _edgeExtractor.SetInput(_stlReader.GetOutput());
            _edgeMapper = vtkPolyDataMapper.New();
            _edgeMapper.SetInput(_edgeExtractor.GetOutput());
            _edgeActor = vtkActor.New();

            double[] rgb = colorToRGB(EdgeColor);

            //couleurs des aretes
            _edgeActor.GetProperty().SetColor(rgb[0], rgb[1], rgb[2]);
            _edgeActor.SetMapper(_edgeMapper);
        }
Exemplo n.º 18
0
        //private vtkActor DrawVehicleID(float curX, float ySign)
        //{

        //				// Create text
        //				vtkVectorText textSource = new vtkVectorText();
        //				textSource.SetText("Hello");
        //				textSource.Update();

        //				// Visualize
        //				vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
        //				mapper.SetInputConnection(textSource.GetOutputPort());


        //				vtkActor textActor = vtkActor.New();

        //				textActor.SetScale(Constants.INDICATOR_TEXT_SIZE_X, Constants.INDICATOR_TEXT_SIZE_Y, 1);

        //				double[] bounds = textActor.GetXRange();

        //				Console.WriteLine(bounds[0]);
        //				Console.WriteLine(bounds[1]);

        //				double halfSize = (bounds[1] - bounds[0]) / 2d;

        //				textActor.SetPosition(curX - halfSize, Constants.INDICATOR_LINE_OFFSET * ySign, 0);

        //				textActor.SetMapper(mapper);
        //				textActor.GetProperty().SetColor(1, 0, 0);

        //				return textActor;
        //}

        private vtkActor DrawLineSector(float startX, float yOffset, float size, Color color, float deltaY)
        {
            float topY = yOffset + Constants.TUBE_DEFAULT_HALFSIZE_Y;
            float botY = yOffset - Constants.TUBE_DEFAULT_HALFSIZE_Y;

            if (deltaY > 0)
            {
                topY += deltaY;
            }
            else
            {
                botY += deltaY;
            }

            vtkPoints points = new vtkPoints();

            points.InsertNextPoint(startX, botY, 0.0);
            points.InsertNextPoint(startX + size, botY, 0.0);
            points.InsertNextPoint(startX + size, topY, 0.0);
            points.InsertNextPoint(startX, topY, 0.0);

            vtkPolygon rectangle = new vtkPolygon();

            rectangle.GetPointIds().SetNumberOfIds(4);
            rectangle.GetPointIds().SetId(0, 0);
            rectangle.GetPointIds().SetId(1, 1);
            rectangle.GetPointIds().SetId(2, 2);
            rectangle.GetPointIds().SetId(3, 3);

            vtkCellArray polygons = new vtkCellArray();

            polygons.InsertNextCell(rectangle);

            vtkPolyData polygonPolyData = new vtkPolyData();

            polygonPolyData.SetPoints(points);
            polygonPolyData.SetPolys(polygons);


            // Visualize
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInput(polygonPolyData);
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetColor(color.r, color.g, color.b);

            return(actor);
        }
Exemplo n.º 19
0
        private void SetFlatData(float[] src)
        {
            using (var warp = vtkWarpScalar.New())
                using (var mapper = vtkPolyDataMapper.New())
                    using (var actor = vtkActor.New())
                    {
                        if (src != null)
                        {
                            IntPtr pIds = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(float)) * Size);
                            Marshal.Copy(src, 0, pIds, Size);

                            var da = vtkFloatArray.New();
                            da.SetArray(pIds, Size, 1);

                            pointPoly.GetPointData().SetScalars(da);
                        }
                        warp.SetInput(pointPoly);
                        warp.SetScaleFactor(Scale);

                        //var transform = vtkTransform.New();
                        //transform.RotateX(180);
                        //var transformFilter = vtkTransformPolyDataFilter.New();
                        //transformFilter.SetTransform(transform);
                        //transformFilter.SetInputConnection(warp.GetOutputPort());

                        //mapper.SetInput(transformFilter.GetOutput());
                        mapper.SetInput(warp.GetPolyDataOutput());

                        mapper.SetLookupTable(lut);
                        //mapper.SetColorModeToMapScalars();
                        mapper.SetScalarRange(ScalarRangeMin, ScalarRangeMax);

                        DataActor.SetMapper(mapper);
                        DataActor.GetProperty().SetPointSize(PointSize);
                        //DataActor.SetOrientation(90, 0, 0);
                    }
        }
        private void ExtractLargestIsoSurface(string filePath, double threshold, bool extractLargest)
        {
            // Load data
            vtkStructuredPointsReader reader = vtkStructuredPointsReader.New();

            reader.SetFileName(filePath);

            // Create a 3D model using marching cubes
            vtkMarchingCubes mc = vtkMarchingCubes.New();

            mc.SetInputConnection(reader.GetOutputPort());
            mc.ComputeNormalsOn();
            mc.ComputeGradientsOn();
            mc.SetValue(0, threshold); // second value acts as threshold

            // To remain largest region
            vtkPolyDataConnectivityFilter confilter = vtkPolyDataConnectivityFilter.New();

            confilter.SetInputConnection(mc.GetOutputPort());
            confilter.SetExtractionModeToLargestRegion();

            // Create a mapper
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            if (extractLargest)
            {
                mapper.SetInputConnection(confilter.GetOutputPort());
            }
            else
            {
                mapper.SetInputConnection(mc.GetOutputPort());
            }

            mapper.ScalarVisibilityOff(); // utilize actor's property I set

            // Visualize
            vtkActor actor = vtkActor.New();

            actor.GetProperty().SetColor(1, 1, 1);
            actor.SetMapper(mapper);

            // get a reference to the renderwindow of our renderWindowControl1
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            // renderer
            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();

            // add our actor to the renderer
            renderer.AddActor(actor);
        }
Exemplo n.º 21
0
        private void BoundaryEdges()
        {
            vtkDiskSource diskSource = vtkDiskSource.New();

            diskSource.Update();

            vtkFeatureEdges featureEdges = vtkFeatureEdges.New();

#if VTK_MAJOR_VERSION_5
            featureEdges.SetInputConnection(diskSource.GetOutputPort());
#else
            featureEdges.SetInputData(diskSource);
#endif
            featureEdges.BoundaryEdgesOn();
            featureEdges.FeatureEdgesOff();
            featureEdges.ManifoldEdgesOff();
            featureEdges.NonManifoldEdgesOff();
            featureEdges.Update();

            // Visualize
            vtkPolyDataMapper edgeMapper = vtkPolyDataMapper.New();
#if VTK_MAJOR_VERSION_5
            edgeMapper.SetInputConnection(featureEdges.GetOutputPort());
#else
            edgeMapper.SetInputData(featureEdges);
#endif
            vtkActor edgeActor = vtkActor.New();
            edgeActor.GetProperty().SetLineWidth(3);
            edgeActor.SetMapper(edgeMapper);

            vtkPolyDataMapper diskMapper = vtkPolyDataMapper.New();
#if VTK_MAJOR_VERSION_5
            diskMapper.SetInputConnection(diskSource.GetOutputPort());
#else
            diskMapper.SetInputData(diskSource);
#endif
            vtkActor diskActor = vtkActor.New();
            diskActor.SetMapper(diskMapper);

            // get a reference to the renderwindow of our renderWindowControl1
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            // renderer
            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();
            // set background color
            renderer.SetBackground(0.3, 0.6, 0.3);
            // add our actor to the renderer
            renderer.AddActor(diskActor);
            renderer.AddActor(edgeActor);
        }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestExtrudePiece(String [] argv)
    {
        //Prefix Content is: ""

          disk = new vtkDiskSource();
          disk.SetRadialResolution((int)2);
          disk.SetCircumferentialResolution((int)9);
          clean = new vtkCleanPolyData();
          clean.SetInputConnection((vtkAlgorithmOutput)disk.GetOutputPort());
          clean.SetTolerance((double)0.01);
          piece = new vtkExtractPolyDataPiece();
          piece.SetInputConnection((vtkAlgorithmOutput)clean.GetOutputPort());
          extrude = new vtkPLinearExtrusionFilter();
          extrude.SetInputConnection((vtkAlgorithmOutput)piece.GetOutputPort());
          extrude.PieceInvariantOn();
          // Create the RenderWindow, Renderer and both Actors[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          mapper = vtkPolyDataMapper.New();
          mapper.SetInputConnection((vtkAlgorithmOutput)extrude.GetOutputPort());
          mapper.SetNumberOfPieces((int)2);
          mapper.SetPiece((int)1);
          bf = new vtkProperty();
          bf.SetColor((double)1,(double)0,(double)0);
          actor = new vtkActor();
          actor.SetMapper((vtkMapper)mapper);
          actor.GetProperty().SetColor((double)1,(double)1,(double)0.8);
          actor.SetBackfaceProperty((vtkProperty)bf);
          // Add the actors to the renderer, set the background and size[]
          //[]
          ren1.AddActor((vtkProp)actor);
          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();
    }
Exemplo n.º 23
0
		private void CreateSurfaceRendering()
		{
			_contourFilter = new vtk.vtkContourFilter();
			_contourFilter.SetInput(_volumeGraphic.GetImageData());
			_contourFilter.SetValue(0, _volumeGraphic.GetRescaledLevel());

			vtkPolyDataNormals normals = new vtk.vtkPolyDataNormals();
			normals.SetInputConnection(_contourFilter.GetOutputPort());
			normals.SetFeatureAngle(60.0);

			vtkStripper stripper = new vtk.vtkStripper();
			stripper.SetInputConnection(normals.GetOutputPort());

			vtkPolyDataMapper mapper = new vtk.vtkPolyDataMapper();
			mapper.SetInputConnection(stripper.GetOutputPort());
			mapper.ScalarVisibilityOff();

			_vtkActor = new vtk.vtkActor();
			_vtkActor.SetMapper(mapper);
			_vtkActor.GetProperty().SetSpecular(.3);
			_vtkActor.GetProperty().SetSpecularPower(20);
			ApplySetting("Opacity");
			ApplySetting("Level");
		}
        //绘制外边框
        private vtkActor BuildOutlineActor(vtkImageData ImageData)
        {
            //创建Outline
            vtkOutlineFilter OutlineFilter = vtkOutlineFilter.New();

            OutlineFilter.SetInput(ImageData);
            vtkPolyDataMapper OutlineMapper = vtkPolyDataMapper.New();

            OutlineMapper.SetInputConnection(OutlineFilter.GetOutputPort());
            vtkActor outlineActor = vtkActor.New();

            outlineActor.SetMapper(OutlineMapper);
            outlineActor.GetProperty().SetColor(0.5, 0.5, 0.5);

            return(outlineActor);
        }
Exemplo n.º 25
0
        public static void Point(vtkActor actor, int[] src, int w, int h)
        {
            using (var lut = vtkLookupTable.New())
                using (var points = vtkPoints.New())
                    using (var vertices = vtkCellArray.New())
                        using (var pointPoly = vtkPolyData.New())
                            using (var mapper = vtkPolyDataMapper.New())
                            {
                                lut.SetHueRange(0.667, 0.0);
                                lut.Build();

                                int[] ids = new int[w * h];
                                for (int y = 0; y < h; y++)
                                {
                                    for (int x = 0; x < w; x++)
                                    {
                                        ids[x + w * y] = points.InsertNextPoint(x, y, src[x + w * y]);
                                    }
                                }


                                int    size = Marshal.SizeOf(typeof(int)) * w * h;
                                IntPtr pIds = Marshal.AllocHGlobal(size);
                                Marshal.Copy(ids, 0, pIds, w * h);
                                vertices.InsertNextCell(w * h, pIds);
                                Marshal.FreeHGlobal(pIds);

                                pointPoly.SetPoints(points);
                                pointPoly.SetVerts(vertices);

                                //fixed (int* pa = data)
                                //{
                                //    var da = vtkIntArray.New();
                                //    da.SetArray((IntPtr)pa, w * h, 1);

                                //    pointPoly.GetPointData().SetScalars(da);
                                //}

                                mapper.SetInput(pointPoly);

                                mapper.SetLookupTable(lut);
                                mapper.SetScalarRange(0.0, 255.0);

                                actor.SetMapper(mapper);
                                actor.GetProperty().SetPointSize(2);
                            }
        }
Exemplo n.º 26
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVRectOutline(String [] argv)
    {
        //Prefix Content is: ""

        // create pipeline[]
        //[]
        reader = new vtkDataSetReader();
        reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
        reader.Update();
        // here to force exact extent[]
        elev = new vtkElevationFilter();
        elev.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
        outline = new vtkRectilinearGridOutlineFilter();
        outline.SetInput((vtkDataObject)elev.GetRectilinearGridOutput());
        outlineMapper = vtkPolyDataMapper.New();
        outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
        outlineMapper.SetNumberOfPieces((int)2);
        outlineMapper.SetPiece((int)1);
        outlineActor = new vtkActor();
        outlineActor.SetMapper((vtkMapper)outlineMapper);
        outlineActor.GetProperty().SetColor((double)0.0000, 0.0000, 0.0000);
        // 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.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)400, (int)400);
        cam1 = ren1.GetActiveCamera();
        cam1.SetClippingRange((double)3.76213, (double)10.712);
        cam1.SetFocalPoint((double)-0.0842503, (double)-0.136905, (double)0.610234);
        cam1.SetPosition((double)2.53813, (double)2.2678, (double)-5.22172);
        cam1.SetViewUp((double)-0.241047, (double)0.930635, (double)0.275343);
        iren.Initialize();
        // render the image[]
        //[]
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }
Exemplo n.º 27
0
        public void ReadPointIntoObject(RenderWindowControl renderWindowControl, List <nvmPointModel> listPointModel)
        {
            vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();

            colors.SetNumberOfComponents(3);
            colors.SetName("Colors");
            vtkPoints points = vtkPoints.New();

            foreach (var point in listPointModel)
            {
                colors.InsertNextValue(byte.Parse(point.color.X.ToString(), CultureInfo.InvariantCulture));
                colors.InsertNextValue(byte.Parse(point.color.Y.ToString(), CultureInfo.InvariantCulture));
                colors.InsertNextValue(byte.Parse(point.color.Z.ToString(), CultureInfo.InvariantCulture));
                points.InsertNextPoint(
                    double.Parse(point.position.X.ToString(), CultureInfo.InvariantCulture),
                    double.Parse(point.position.Y.ToString(), CultureInfo.InvariantCulture),
                    double.Parse(point.position.Z.ToString(), CultureInfo.InvariantCulture));
            }

            vtkPolyData polydata = vtkPolyData.New();

            polydata.SetPoints(points);
            polydata.GetPointData().SetScalars(colors);
            vtkVertexGlyphFilter glyphFilter = vtkVertexGlyphFilter.New();

            glyphFilter.SetInputConnection(polydata.GetProducerPort());

            // Visualize
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(glyphFilter.GetOutputPort());
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetPointSize(2);
            // get a reference to the renderwindow of our renderWindowControl1
            vtkRenderWindow renderWindow = renderWindowControl.RenderWindow;
            // renderer
            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();

            // set background color
            renderer.SetBackground(0.2, 0.3, 0.4);
            // add our actor to the renderer
            renderer.AddActor(actor);
            renderer.ResetCamera();
        }
Exemplo n.º 28
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVRectOutline(String [] argv)
    {
        //Prefix Content is: ""

          // create pipeline[]
          //[]
          reader = new vtkDataSetReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
          reader.Update();
          // here to force exact extent[]
          elev = new vtkElevationFilter();
          elev.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          outline = new vtkRectilinearGridOutlineFilter();
          outline.SetInput((vtkDataObject)elev.GetRectilinearGridOutput());
          outlineMapper = vtkPolyDataMapper.New();
          outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineMapper.SetNumberOfPieces((int)2);
          outlineMapper.SetPiece((int)1);
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outlineMapper);
          outlineActor.GetProperty().SetColor((double) 0.0000, 0.0000, 0.0000 );
          // 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.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)400,(int)400);
          cam1 = ren1.GetActiveCamera();
          cam1.SetClippingRange((double)3.76213,(double)10.712);
          cam1.SetFocalPoint((double)-0.0842503,(double)-0.136905,(double)0.610234);
          cam1.SetPosition((double)2.53813,(double)2.2678,(double)-5.22172);
          cam1.SetViewUp((double)-0.241047,(double)0.930635,(double)0.275343);
          iren.Initialize();
          // render the image[]
          //[]
          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
Exemplo n.º 29
0
        private void ReadRectilinearGrid()
        {
            // Path to vtk data must be set as an environment variable
            // VTK_DATA_ROOT = "C:\VTK\vtkdata-5.8.0"
            vtkTesting test     = vtkTesting.New();
            string     root     = test.GetDataRoot();
            string     filePath = System.IO.Path.Combine(root, @"Data\cth.vtr");
            // reader
            vtkXMLRectilinearGridReader reader = vtkXMLRectilinearGridReader.New();

            if (reader.CanReadFile(filePath) == 0)
            {
                MessageBox.Show("Cannot read file \"" + filePath + "\"", "Error", MessageBoxButtons.OK);
                return;
            }
            reader.SetFileName(filePath);
            reader.Update(); // here we read the file actually

            //vtkRectilinearGridGeometryFilter geometryFilter = vtkRectilinearGridGeometryFilter.New();
            //geometryFilter.SetInputConnection(reader.GetOutputPort());
            //geometryFilter.Update();


            // Visualize
            // mapper
            vtkDataSetMapper mapper = vtkDataSetMapper.New();

            //mapper.SetInputConnection(geometryFilter.GetOutputPort());
            mapper.SetInputConnection(reader.GetOutputPort());

            // actor
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetRepresentationToWireframe();
            // get a reference to the renderwindow of our renderWindowControl1
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            // renderer
            vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();

            // set background color
            renderer.SetBackground(0.2, 0.3, 0.4);
            // add our actor to the renderer
            renderer.AddActor(actor);
        }
Exemplo n.º 30
0
        ///<summary>Entry Point</summary>
        static void Main(string[] args)
        {
            // Create a simple sphere. A pipeline is created.
            sphere = vtkSphereSource.New();
            sphere.SetThetaResolution(8);
            sphere.SetPhiResolution(16);

            shrink = vtkShrinkPolyData.New();
            shrink.SetInputConnection(sphere.GetOutputPort());
            shrink.SetShrinkFactor(0.9);

            mapper = vtkPolyDataMapper.New();
            mapper.SetInputConnection(shrink.GetOutputPort());

            // The actor links the data pipeline to the rendering subsystem
            actor = vtkActor.New();
            actor.SetMapper(mapper);
            actor.GetProperty().SetColor(1, 0, 0);

            // Create components of the rendering subsystem
            //
            ren1 = vtkRenderer.New();
            renWin = vtkRenderWindow.New();
            renWin.AddRenderer(ren1);
            iren = vtkRenderWindowInteractor.New();
            iren.SetRenderWindow(renWin);

            // Add the actors to the renderer, set the window size
            //
            ren1.AddViewProp(actor);
            renWin.SetSize(250, 250);
            renWin.Render();
            camera = ren1.GetActiveCamera();
            camera.Zoom(1.5);

            // render the image and start the event loop
            //
            renWin.Render();

            iren.Initialize();
            iren.Start();

            deleteAllVTKObjects();
        }
Exemplo n.º 31
0
        private void button3_Click(object sender, EventArgs e)
        {
            //string path= @"d:\Staz\projekt2\Projekt2\Projekt2\dokument.pdf";
            //FileStream fs = File.Create(path);
            //Document document = new Document(PageSize.A4, 25, 25, 30, 30);
            //PdfWriter writer = PdfWriter.GetInstance(document, fs);
            //document.AddAuthor("KatarzynaWidawka");
            //document.Open();
            //document.Add(new Paragraph("Hello World!"));
            //document.Close();
            //writer.Close();
            //fs.Close();

            //----------------------------------------------------------------

            vtkCylinderSource cylinder = vtkCylinderSource.New();

            cylinder.SetResolution(8);
            vtkPolyDataMapper cmapper = vtkPolyDataMapper.New();

            cmapper.SetInputConnection(cylinder.GetOutputPort());
            vtkActor cactor = vtkActor.New();

            cactor.SetMapper(cmapper);
            cactor.GetProperty().SetColor(1.0000, 0.3882, 0.2784);
            vtkSTLWriter stlwriter = vtkSTLWriter.New();

            stlwriter.SetFileName("object.stl");
            //stlwriter.Write();

            string     path     = @"d:\Staz\projekt2\Projekt2\Projekt2\dokument.pdf";
            FileStream fs       = File.Create(path);
            Document   document = new Document(PageSize.A4, 25, 25, 30, 30);
            PdfWriter  writer   = PdfWriter.GetInstance(document, fs);

            document.AddAuthor("KatarzynaWidawka");
            document.Open();
            System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 400, 500, 800);
            document.Add(new Paragraph("Hello World!"));
            // document.Add(cactor);
            document.Close();
            writer.Close();
            fs.Close();
        }
Exemplo n.º 32
0
        private void TriangleStrip()
        {
            vtkPoints points = vtkPoints.New();

            points.InsertNextPoint(0, 0, 0);
            points.InsertNextPoint(0, 1, 0);
            points.InsertNextPoint(1, 0, 0);
            points.InsertNextPoint(1.5, 1, 0);

            vtkTriangleStrip triangleStrip = vtkTriangleStrip.New();

            triangleStrip.GetPointIds().SetNumberOfIds(4);
            triangleStrip.GetPointIds().SetId(0, 0);
            triangleStrip.GetPointIds().SetId(1, 1);
            triangleStrip.GetPointIds().SetId(2, 2);
            triangleStrip.GetPointIds().SetId(3, 3);

            vtkCellArray cells = vtkCellArray.New();

            cells.InsertNextCell(triangleStrip);
            // Create a polydata to store everything in
            vtkPolyData polyData = vtkPolyData.New();

            // Add the points to the dataset
            polyData.SetPoints(points);
            // Add the strip to the dataset
            polyData.SetStrips(cells);

            //Create an actor and mapper
            vtkDataSetMapper mapper = vtkDataSetMapper.New();

            mapper.SetInput(polyData);
            vtkActor actor = vtkActor.New();

            actor.GetProperty().SetRepresentationToWireframe();

            actor.SetMapper(mapper);
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            vtkRenderer     renderer     = renderWindow.GetRenderers().GetFirstRenderer();

            renderer.SetBackground(0.2, 0.3, 0.4);
            renderer.AddActor(actor);
        }
Exemplo n.º 33
0
        public void SetPosition(double[] xyz1, double[] xyz2)
        {
            vtkPoints points = vtkPoints.New();

            points.InsertPoint(0, xyz1[0], xyz1[1], xyz1[2]);
            points.InsertPoint(1, xyz2[0], xyz2[1], xyz2[2]);

            vtkCellArray lines = vtkCellArray.New();

            lines.InsertNextCell(2);

            lines.InsertCellPoint(0);
            lines.InsertCellPoint(1);

            vtkPolyData profileData = new vtkPolyData();

            profileData.SetPoints(points);
            profileData.SetLines(lines);
            profileData.SetVerts(lines);
            profileData.Update();

            vtkCleanPolyData cleanFilter = new vtkCleanPolyData();

            cleanFilter.SetInput(profileData);
            cleanFilter.Update();

            vtkTubeFilter profileTubes = new vtkTubeFilter();

            profileTubes.SetNumberOfSides(10);
            profileTubes.SetInput(cleanFilter.GetOutput());
            //profileTubes.SetVaryRadiusToVaryRadiusByVector();
            profileTubes.SetRadius(1);
            profileTubes.SetInputArrayToProcess(1, 0, 0, 0, "vectors");

            //vtkPolyDataMapper profileMapper = new vtkPolyDataMapper();
            //profileMapper.SetInputConnection(profileTubes.GetOutputPort());

            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInput(profileTubes.GetOutput());

            centerLineActor.SetMapper(mapper);
            centerLineActor.GetProperty().SetOpacity(0.5);
        }
Exemplo n.º 34
0
        private void Plane()
        {
            // Create a plane
            vtkPlaneSource planeSource = vtkPlaneSource.New();

            planeSource.SetCenter(1.0, 0.0, 0.0);
            planeSource.SetNormal(1.0, 0.0, 1.0);
            planeSource.Update();

            // Visualize
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(planeSource.GetOutputPort());
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetLineWidth(4);

            RenderAddActor(actor);
        }
Exemplo n.º 35
0
        private void RegularPolygon()
        {
            // Create a pentagon
            vtkRegularPolygonSource polygonSource = vtkRegularPolygonSource.New();

            //polygonSource.GeneratePolygonOff();
            polygonSource.SetNumberOfSides(5);
            polygonSource.SetRadius(5);
            polygonSource.SetCenter(0, 0, 0);
            //polygonSource.Update(); // not necessary

            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(polygonSource.GetOutputPort());
            vtkActor actor = vtkActor.New();

            actor.GetProperty().SetLineWidth(4);
            actor.SetMapper(mapper);
            RenderAddActor(actor);
        }
Exemplo n.º 36
0
    /// <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();
    }
Exemplo n.º 37
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVStreamPolyData(String [] argv)
    {
        //Prefix Content is: ""

          NUMBER_OF_PIECES = 5;
          // Generate implicit model of a sphere[]
          //[]
          // Create renderer stuff[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // create pipeline that handles ghost cells[]
          sphere = new vtkSphereSource();
          sphere.SetRadius((double)3);
          sphere.SetPhiResolution((int)100);
          sphere.SetThetaResolution((int)150);
          // sphere AddObserver StartEvent {tk_messageBox -message "Executing with piece [[sphere GetOutput] GetUpdatePiece]"}[]
          // Just playing with an alternative that is not currently used.[]
          //method moved
          // Just playing with an alternative that is not currently used.[]
          deci = new vtkDecimatePro();
          deci.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
          // this did not remove seams as I thought it would[]
          deci.BoundaryVertexDeletionOff();
          //deci PreserveTopologyOn[]
          // Since quadric Clustering does not handle borders properly yet,[]
          // the pieces will have dramatic "eams"[]
          q = new vtkQuadricClustering();
          q.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
          q.SetNumberOfXDivisions((int)5);
          q.SetNumberOfYDivisions((int)5);
          q.SetNumberOfZDivisions((int)10);
          q.UseInputPointsOn();
          streamer = new vtkPolyDataStreamer();
          //streamer SetInputConnection [deci GetOutputPort][]
          streamer.SetInputConnection((vtkAlgorithmOutput)q.GetOutputPort());
          //streamer SetInputConnection [pdn GetOutputPort][]
          streamer.SetNumberOfStreamDivisions((int)NUMBER_OF_PIECES);
          mapper = vtkPolyDataMapper.New();
          mapper.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          mapper.ScalarVisibilityOff();
          mapper.SetPiece((int)0);
          mapper.SetNumberOfPieces((int)2);
          mapper.ImmediateModeRenderingOn();
          actor = new vtkActor();
          actor.SetMapper((vtkMapper)mapper);
          actor.GetProperty().SetColor((double) 0.8300, 0.2400, 0.1000 );
          // Add the actors to the renderer, set the background and size[]
          //[]
          ren1.GetActiveCamera().SetPosition((double)5,(double)5,(double)10);
          ren1.GetActiveCamera().SetFocalPoint((double)0,(double)0,(double)0);
          ren1.AddActor((vtkProp)actor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)300,(int)300);
          iren.Initialize();
          // render the image[]
          //[]
          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
Exemplo n.º 38
0
    /// <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 vtkMultiBlockPLOT3DReader();
          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.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
          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().GetBlock(0)).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
          plane1Actor = new vtkActor();
          plane1Actor.SetMapper((vtkMapper)plane1Map);
          plane1Actor.GetProperty().SetOpacity((double)0.999);
          // outline[]
          outline = new vtkStructuredGridOutlineFilter();
          outline.SetInputData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
          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();
    }
Exemplo n.º 39
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTenEllip(String [] argv)
    {
        //Prefix Content is: ""

          // create tensor ellipsoids[]
          // Create the RenderWindow, Renderer and interactive renderer[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.SetMultiSamples(0);
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          //[]
          // Create tensor ellipsoids[]
          //[]
          // generate tensors[]
          ptLoad = new vtkPointLoad();
          ptLoad.SetLoadValue((double)100.0);
          ptLoad.SetSampleDimensions((int)6,(int)6,(int)6);
          ptLoad.ComputeEffectiveStressOn();
          ptLoad.SetModelBounds((double)-10,(double)10,(double)-10,(double)10,(double)-10,(double)10);
          // extract plane of data[]
          plane = new vtkImageDataGeometryFilter();
          plane.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort());
          plane.SetExtent((int)2,(int)2,(int)0,(int)99,(int)0,(int)99);
          // Generate ellipsoids[]
          sphere = new vtkSphereSource();
          sphere.SetThetaResolution((int)8);
          sphere.SetPhiResolution((int)8);
          ellipsoids = new vtkTensorGlyph();
          ellipsoids.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort());
          ellipsoids.SetSourceConnection((vtkAlgorithmOutput)sphere.GetOutputPort());
          ellipsoids.SetScaleFactor((double)10);
          ellipsoids.ClampScalingOn();
          ellipNormals = new vtkPolyDataNormals();
          ellipNormals.SetInputConnection((vtkAlgorithmOutput)ellipsoids.GetOutputPort());
          // Map contour[]
          lut = new vtkLogLookupTable();
          lut.SetHueRange((double).6667,(double)0.0);
          ellipMapper = vtkPolyDataMapper.New();
          ellipMapper.SetInputConnection((vtkAlgorithmOutput)ellipNormals.GetOutputPort());
          ellipMapper.SetLookupTable((vtkScalarsToColors)lut);
          plane.Update();
          //force update for scalar range[]
          ellipMapper.SetScalarRange((double)((vtkDataSet)plane.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)plane.GetOutput()).GetScalarRange()[1]);
          ellipActor = new vtkActor();
          ellipActor.SetMapper((vtkMapper)ellipMapper);
          //[]
          // Create outline around data[]
          //[]
          outline = new vtkOutlineFilter();
          outline.SetInputConnection((vtkAlgorithmOutput)ptLoad.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);
          //[]
          // Create cone indicating application of load[]
          //[]
          coneSrc = new vtkConeSource();
          coneSrc.SetRadius((double).5);
          coneSrc.SetHeight((double)2);
          coneMap = vtkPolyDataMapper.New();
          coneMap.SetInputConnection((vtkAlgorithmOutput)coneSrc.GetOutputPort());
          coneActor = new vtkActor();
          coneActor.SetMapper((vtkMapper)coneMap);
          coneActor.SetPosition((double)0,(double)0,(double)11);
          coneActor.RotateY((double)90);
          coneActor.GetProperty().SetColor((double)1,(double)0,(double)0);
          camera = new vtkCamera();
          camera.SetFocalPoint((double)0.113766,(double)-1.13665,(double)-1.01919);
          camera.SetPosition((double)-29.4886,(double)-63.1488,(double)26.5807);
          camera.SetViewAngle((double)24.4617);
          camera.SetViewUp((double)0.17138,(double)0.331163,(double)0.927879);
          camera.SetClippingRange((double)1,(double)100);
          ren1.AddActor((vtkProp)ellipActor);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)coneActor);
          ren1.SetBackground((double)1.0,(double)1.0,(double)1.0);
          ren1.SetActiveCamera((vtkCamera)camera);
          renWin.SetSize((int)400,(int)400);
          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 AVEnSightRectGridASCII(String [] argv)
    {
        //Prefix Content is: ""

          VTK_VARY_RADIUS_BY_VECTOR = 2;
          // create pipeline[]
          //[]
          reader = new vtkGenericEnSightReader();
          // Make sure all algorithms use the composite data pipeline[]
          cdp = new vtkCompositeDataPipeline();
          vtkGenericEnSightReader.SetDefaultExecutivePrototype((vtkExecutive)cdp);
          reader.SetCaseFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/EnSight/RectGrid_ascii.case");
          reader.Update();
          toRectilinearGrid = new vtkCastToConcrete();
          //    toRectilinearGrid SetInputConnection [reader GetOutputPort] []
          toRectilinearGrid.SetInput((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          plane = new vtkRectilinearGridGeometryFilter();
          plane.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          plane.SetExtent((int)0,(int)100,(int)0,(int)100,(int)15,(int)15);
          tri = new vtkTriangleFilter();
          tri.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          warper = new vtkWarpVector();
          warper.SetInputConnection((vtkAlgorithmOutput)tri.GetOutputPort());
          warper.SetScaleFactor((double)0.05);
          planeMapper = new vtkDataSetMapper();
          planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
          planeMapper.SetScalarRange((double)0.197813,(double)0.710419);
          planeActor = new vtkActor();
          planeActor.SetMapper((vtkMapper)planeMapper);
          cutPlane = new vtkPlane();
          //    eval cutPlane SetOrigin [[reader GetOutput] GetCenter][]
          cutPlane.SetOrigin((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[0], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[1], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetCenter()[2]);
          cutPlane.SetNormal((double)1,(double)0,(double)0);
          planeCut = new vtkCutter();
          planeCut.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
          cutMapper = new vtkDataSetMapper();
          cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());
          cutMapper.SetScalarRange((double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)((vtkMultiBlockDataSet)reader.GetOutput()).GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
          cutActor = new vtkActor();
          cutActor.SetMapper((vtkMapper)cutMapper);
          iso = new vtkContourFilter();
          iso.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          iso.SetValue((int)0,(double)0.7);
          normals = new vtkPolyDataNormals();
          normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
          normals.SetFeatureAngle((double)45);
          isoMapper = vtkPolyDataMapper.New();
          isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
          isoMapper.ScalarVisibilityOff();
          isoActor = new vtkActor();
          isoActor.SetMapper((vtkMapper)isoMapper);
          isoActor.GetProperty().SetColor((double) 1.0000, 0.8941, 0.7686 );
          isoActor.GetProperty().SetRepresentationToWireframe();
          streamer = new vtkStreamLine();
          //    streamer SetInputConnection [reader GetOutputPort][]
          streamer.SetInput((vtkDataObject)reader.GetOutput().GetBlock((uint)0));
          streamer.SetStartPosition((double)-1.2,(double)-0.1,(double)1.3);
          streamer.SetMaximumPropagationTime((double)500);
          streamer.SetStepLength((double)0.05);
          streamer.SetIntegrationStepLength((double)0.05);
          streamer.SetIntegrationDirectionToIntegrateBothDirections();
          streamTube = new vtkTubeFilter();
          streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          streamTube.SetRadius((double)0.025);
          streamTube.SetNumberOfSides((int)6);
          streamTube.SetVaryRadius((int)VTK_VARY_RADIUS_BY_VECTOR);
          mapStreamTube = vtkPolyDataMapper.New();
          mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
          mapStreamTube.SetScalarRange((double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[0], (double)((vtkDataSet)reader.GetOutput().GetBlock((uint)0)).GetPointData().GetScalars().GetRange()[1]);
          //       [[[[reader GetOutput] GetPointData] GetScalars] GetRange][]
          streamTubeActor = new vtkActor();
          streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
          streamTubeActor.GetProperty().BackfaceCullingOn();
          outline = new vtkOutlineFilter();
          outline.SetInput((vtkDataObject)toRectilinearGrid.GetRectilinearGridOutput());
          outlineMapper = vtkPolyDataMapper.New();
          outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outlineMapper);
          outlineActor.GetProperty().SetColor((double) 0.0000, 0.0000, 0.0000 );
          // 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)planeActor);
          ren1.AddActor((vtkProp)cutActor);
          ren1.AddActor((vtkProp)isoActor);
          ren1.AddActor((vtkProp)streamTubeActor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)400,(int)400);
          cam1 = ren1.GetActiveCamera();
          cam1.SetClippingRange((double)3.76213,(double)10.712);
          cam1.SetFocalPoint((double)-0.0842503,(double)-0.136905,(double)0.610234);
          cam1.SetPosition((double)2.53813,(double)2.2678,(double)-5.22172);
          cam1.SetViewUp((double)-0.241047,(double)0.930635,(double)0.275343);
          iren.Initialize();
          // render the image[]
          //[]
          // prevent the tk window from showing up then start the event loop[]
          vtkGenericEnSightReader.SetDefaultExecutivePrototype(null);

        //deleteAllVTKObjects();
    }
Exemplo n.º 41
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVfieldToRGrid(String [] argv)
    {
        //Prefix Content is: ""

          //# Generate a rectilinear grid from a field.[]
          //#[]
          // get the interactor ui[]
          // Create a reader and write out the field[]
          reader = new vtkDataSetReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/RectGrid2.vtk");
          ds2do = new vtkDataSetToDataObjectFilter();
          ds2do.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          try
          {
         channel = new StreamWriter("RGridField.vtk");
          tryCatchError = "NOERROR";
          }
          catch(Exception)
          {tryCatchError = "ERROR";}

        if(tryCatchError.Equals("NOERROR"))
          {
          channel.Close();
          writer = new vtkDataObjectWriter();
          writer.SetInputConnection((vtkAlgorithmOutput)ds2do.GetOutputPort());
          writer.SetFileName((string)"RGridField.vtk");
          writer.Write();
          // Read the field[]
          //[]
          dor = new vtkDataObjectReader();
          dor.SetFileName((string)"RGridField.vtk");
          do2ds = new vtkDataObjectToDataSetFilter();
          do2ds.SetInputConnection((vtkAlgorithmOutput)dor.GetOutputPort());
          do2ds.SetDataSetTypeToRectilinearGrid();
          do2ds.SetDimensionsComponent((string)"Dimensions",(int)0);
          do2ds.SetPointComponent((int)0,(string)"XCoordinates",(int)0);
          do2ds.SetPointComponent((int)1,(string)"YCoordinates",(int)0);
          do2ds.SetPointComponent((int)2,(string)"ZCoordinates",(int)0);
          fd2ad = new vtkFieldDataToAttributeDataFilter();
          fd2ad.SetInput((vtkDataObject)do2ds.GetRectilinearGridOutput());
          fd2ad.SetInputFieldToDataObjectField();
          fd2ad.SetOutputAttributeDataToPointData();
          fd2ad.SetVectorComponent((int)0,(string)"vectors",(int)0);
          fd2ad.SetVectorComponent((int)1,(string)"vectors",(int)1);
          fd2ad.SetVectorComponent((int)2,(string)"vectors",(int)2);
          fd2ad.SetScalarComponent((int)0,(string)"scalars",(int)0);
          fd2ad.Update();
          // create pipeline[]
          //[]
          plane = new vtkRectilinearGridGeometryFilter();
          plane.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
          plane.SetExtent((int)0,(int)100,(int)0,(int)100,(int)15,(int)15);
          warper = new vtkWarpVector();
          warper.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          warper.SetScaleFactor((double)0.05);
          planeMapper = new vtkDataSetMapper();
          planeMapper.SetInputConnection((vtkAlgorithmOutput)warper.GetOutputPort());
          planeMapper.SetScalarRange((double)0.197813,(double)0.710419);
          planeActor = new vtkActor();
          planeActor.SetMapper((vtkMapper)planeMapper);
          cutPlane = new vtkPlane();
          cutPlane.SetOrigin(fd2ad.GetOutput().GetCenter()[0],fd2ad.GetOutput().GetCenter()[1],fd2ad.GetOutput().GetCenter()[2]);
          cutPlane.SetNormal((double)1,(double)0,(double)0);
          planeCut = new vtkCutter();
          planeCut.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
          planeCut.SetCutFunction((vtkImplicitFunction)cutPlane);
          cutMapper = new vtkDataSetMapper();
          cutMapper.SetInputConnection((vtkAlgorithmOutput)planeCut.GetOutputPort());
          cutMapper.SetScalarRange(
          (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[0],
          (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
          cutActor = new vtkActor();
          cutActor.SetMapper((vtkMapper)cutMapper);
          iso = new vtkContourFilter();
          iso.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
          iso.SetValue((int)0,(double)0.7);
          normals = new vtkPolyDataNormals();
          normals.SetInputConnection((vtkAlgorithmOutput)iso.GetOutputPort());
          normals.SetFeatureAngle((double)45);
          isoMapper = vtkPolyDataMapper.New();
          isoMapper.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort());
          isoMapper.ScalarVisibilityOff();
          isoActor = new vtkActor();
          isoActor.SetMapper((vtkMapper)isoMapper);
          isoActor.GetProperty().SetColor((double) 1.0000, 0.8941, 0.7686 );
          isoActor.GetProperty().SetRepresentationToWireframe();
          streamer = new vtkStreamLine();
          streamer.SetInputConnection((vtkAlgorithmOutput)fd2ad.GetOutputPort());
          streamer.SetStartPosition((double)-1.2,(double)-0.1,(double)1.3);
          streamer.SetMaximumPropagationTime((double)500);
          streamer.SetStepLength((double)0.05);
          streamer.SetIntegrationStepLength((double)0.05);
          streamer.SetIntegrationDirectionToIntegrateBothDirections();
          streamTube = new vtkTubeFilter();
          streamTube.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          streamTube.SetRadius((double)0.025);
          streamTube.SetNumberOfSides((int)6);
          streamTube.SetVaryRadiusToVaryRadiusByVector();
          mapStreamTube = vtkPolyDataMapper.New();
          mapStreamTube.SetInputConnection((vtkAlgorithmOutput)streamTube.GetOutputPort());
          mapStreamTube.SetScalarRange(
          (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[0],
          (double)((vtkDataSet)fd2ad.GetOutput()).GetPointData().GetScalars().GetRange()[1]);
          streamTubeActor = new vtkActor();
          streamTubeActor.SetMapper((vtkMapper)mapStreamTube);
          streamTubeActor.GetProperty().BackfaceCullingOn();
          outline = new vtkOutlineFilter();
          outline.SetInput((vtkDataObject)fd2ad.GetRectilinearGridOutput());
          outlineMapper = vtkPolyDataMapper.New();
          outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outlineMapper);
          outlineActor.GetProperty().SetColor((double) 0.0000, 0.0000, 0.0000 );
          // 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)planeActor);
          ren1.AddActor((vtkProp)cutActor);
          ren1.AddActor((vtkProp)isoActor);
          ren1.AddActor((vtkProp)streamTubeActor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)300,(int)300);
          ren1.GetActiveCamera().SetPosition((double)0.0390893,(double)0.184813,(double)-3.94026);
          ren1.GetActiveCamera().SetFocalPoint((double)-0.00578326,(double)0,(double)0.701967);
          ren1.GetActiveCamera().SetViewAngle((double)30);
          ren1.GetActiveCamera().SetViewUp((double)0.00850257,(double)0.999169,(double)0.0398605);
          ren1.GetActiveCamera().SetClippingRange((double)3.08127,(double)6.62716);
          iren.Initialize();
          // render the image[]
          //[]

          File.Delete("RGridField.vtk");

        }

          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
Exemplo n.º 42
0
 private vtkActor LoadSTL(vtkActor actor, string path, Color color)
 {
     vtkSTLReader reader = vtkSTLReader.New();
     string filePath = string.Concat(Environment.CurrentDirectory, path);
     reader.SetFileName(filePath);
     reader.Update();
     vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
     mapper.SetInputConnection(reader.GetOutputPort());
     actor = vtkActor.New();
     actor.SetMapper(mapper);
     actor.GetProperty().SetColor((double)color.R / 255, (double)color.G / 255, (double)color.B / 255);
     return actor;
 }
Exemplo n.º 43
0
    /// <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();
    }
Exemplo n.º 44
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVMatrixToTransform(String [] argv)
    {
        //Prefix Content is: ""

          // This example demonstrates how to use a matrix in place of a transfrom[]
          // via vtkMatrixToLinearTransform and vtkMatrixToHomogeneousTransform.[]
          // create a rendering window[]
          renWin = vtkRenderWindow.New();
          renWin.SetSize((int)600,(int)300);
          // set up first set of polydata[]
          p1 = new vtkPlaneSource();
          p1.SetOrigin((double)0.5,(double)0.508,(double)-0.5);
          p1.SetPoint1((double)-0.5,(double)0.508,(double)-0.5);
          p1.SetPoint2((double)0.5,(double)0.508,(double)0.5);
          p1.SetXResolution((int)5);
          p1.SetYResolution((int)5);
          p2 = new vtkPlaneSource();
          p2.SetOrigin((double)-0.508,(double)0.5,(double)-0.5);
          p2.SetPoint1((double)-0.508,(double)-0.5,(double)-0.5);
          p2.SetPoint2((double)-0.508,(double)0.5,(double)0.5);
          p2.SetXResolution((int)5);
          p2.SetYResolution((int)5);
          p3 = new vtkPlaneSource();
          p3.SetOrigin((double)-0.5,(double)-0.508,(double)-0.5);
          p3.SetPoint1((double)0.5,(double)-0.508,(double)-0.5);
          p3.SetPoint2((double)-0.5,(double)-0.508,(double)0.5);
          p3.SetXResolution((int)5);
          p3.SetYResolution((int)5);
          p4 = new vtkPlaneSource();
          p4.SetOrigin((double)0.508,(double)-0.5,(double)-0.5);
          p4.SetPoint1((double)0.508,(double)0.5,(double)-0.5);
          p4.SetPoint2((double)0.508,(double)-0.5,(double)0.5);
          p4.SetXResolution((int)5);
          p4.SetYResolution((int)5);
          p5 = new vtkPlaneSource();
          p5.SetOrigin((double)0.5,(double)0.5,(double)-0.508);
          p5.SetPoint1((double)0.5,(double)-0.5,(double)-0.508);
          p5.SetPoint2((double)-0.5,(double)0.5,(double)-0.508);
          p5.SetXResolution((int)5);
          p5.SetYResolution((int)5);
          p6 = new vtkPlaneSource();
          p6.SetOrigin((double)0.5,(double)0.5,(double)0.508);
          p6.SetPoint1((double)-0.5,(double)0.5,(double)0.508);
          p6.SetPoint2((double)0.5,(double)-0.5,(double)0.508);
          p6.SetXResolution((int)5);
          p6.SetYResolution((int)5);
          // append together[]
          ap = new vtkAppendPolyData();
          ap.AddInputConnection(p1.GetOutputPort());
          ap.AddInputConnection(p2.GetOutputPort());
          ap.AddInputConnection(p3.GetOutputPort());
          ap.AddInputConnection(p4.GetOutputPort());
          ap.AddInputConnection(p5.GetOutputPort());
          ap.AddInputConnection(p6.GetOutputPort());
          //--------------------------[]
          // linear transform matrix[]
          t1 = new vtkMatrixToLinearTransform();
          m1 = new vtkMatrix4x4();
          t1.SetInput((vtkMatrix4x4)m1);
          m1.SetElement((int)0,(int)0,(double)1.127631);
          m1.SetElement((int)0,(int)1,(double)0.205212);
          m1.SetElement((int)0,(int)2,(double)-0.355438);
          m1.SetElement((int)1,(int)0,(double)0.000000);
          m1.SetElement((int)1,(int)1,(double)0.692820);
          m1.SetElement((int)1,(int)2,(double)0.400000);
          m1.SetElement((int)2,(int)0,(double)0.200000);
          m1.SetElement((int)2,(int)1,(double)-0.469846);
          m1.SetElement((int)2,(int)2,(double)0.813798);
          f11 = new vtkTransformPolyDataFilter();
          f11.SetInputConnection((vtkAlgorithmOutput)ap.GetOutputPort());
          f11.SetTransform((vtkAbstractTransform)t1);
          m11 = new vtkDataSetMapper();
          m11.SetInputConnection((vtkAlgorithmOutput)f11.GetOutputPort());
          a11 = new vtkActor();
          a11.SetMapper((vtkMapper)m11);
          a11.GetProperty().SetColor((double)1,(double)0,(double)0);
          a11.GetProperty().SetRepresentationToWireframe();
          ren11 = vtkRenderer.New();
          ren11.SetViewport((double)0.0,(double)0.5,(double)0.25,(double)1.0);
          ren11.ResetCamera((double)-0.5,(double)0.5,(double)-0.5,(double)0.5,(double)-1,(double)1);
          ren11.AddActor((vtkProp)a11);
          renWin.AddRenderer((vtkRenderer)ren11);
          // inverse identity transform[]
          f12 = new vtkTransformPolyDataFilter();
          f12.SetInputConnection((vtkAlgorithmOutput)ap.GetOutputPort());
          f12.SetTransform((vtkAbstractTransform)t1.GetInverse());
          m12 = new vtkDataSetMapper();
          m12.SetInputConnection((vtkAlgorithmOutput)f12.GetOutputPort());
          a12 = new vtkActor();
          a12.SetMapper((vtkMapper)m12);
          a12.GetProperty().SetColor((double)0.9,(double)0.9,(double)0);
          a12.GetProperty().SetRepresentationToWireframe();
          ren12 = vtkRenderer.New();
          ren12.SetViewport((double)0.0,(double)0.0,(double)0.25,(double)0.5);
          ren12.ResetCamera((double)-0.5,(double)0.5,(double)-0.5,(double)0.5,(double)-1,(double)1);
          ren12.AddActor((vtkProp)a12);
          renWin.AddRenderer((vtkRenderer)ren12);
          //--------------------------[]
          // perspective transform matrix[]
          m2 = new vtkMatrix4x4();
          m2.SetElement((int)3,(int)0,(double)-0.11);
          m2.SetElement((int)3,(int)1,(double)0.3);
          m2.SetElement((int)3,(int)2,(double)0.2);
          t2 = new vtkMatrixToHomogeneousTransform();
          t2.SetInput((vtkMatrix4x4)m2);
          f21 = new vtkTransformPolyDataFilter();
          f21.SetInputConnection((vtkAlgorithmOutput)ap.GetOutputPort());
          f21.SetTransform((vtkAbstractTransform)t2);
          m21 = new vtkDataSetMapper();
          m21.SetInputConnection((vtkAlgorithmOutput)f21.GetOutputPort());
          a21 = new vtkActor();
          a21.SetMapper((vtkMapper)m21);
          a21.GetProperty().SetColor((double)1,(double)0,(double)0);
          a21.GetProperty().SetRepresentationToWireframe();
          ren21 = vtkRenderer.New();
          ren21.SetViewport((double)0.25,(double)0.5,(double)0.50,(double)1.0);
          ren21.ResetCamera((double)-0.5,(double)0.5,(double)-0.5,(double)0.5,(double)-1,(double)1);
          ren21.AddActor((vtkProp)a21);
          renWin.AddRenderer((vtkRenderer)ren21);
          // inverse linear transform[]
          f22 = new vtkTransformPolyDataFilter();
          f22.SetInputConnection((vtkAlgorithmOutput)ap.GetOutputPort());
          f22.SetTransform((vtkAbstractTransform)t2.GetInverse());
          m22 = new vtkDataSetMapper();
          m22.SetInputConnection((vtkAlgorithmOutput)f22.GetOutputPort());
          a22 = new vtkActor();
          a22.SetMapper((vtkMapper)m22);
          a22.GetProperty().SetColor((double)0.9,(double)0.9,(double)0);
          a22.GetProperty().SetRepresentationToWireframe();
          ren22 = vtkRenderer.New();
          ren22.SetViewport((double)0.25,(double)0.0,(double)0.50,(double)0.5);
          ren22.ResetCamera((double)-0.5,(double)0.5,(double)-0.5,(double)0.5,(double)-1,(double)1);
          ren22.AddActor((vtkProp)a22);
          renWin.AddRenderer((vtkRenderer)ren22);
          //--------------------------[]
          // linear concatenation - should end up with identity here[]
          t3 = new vtkTransform();
          t3.Concatenate((vtkLinearTransform)t1);
          t3.Concatenate((vtkLinearTransform)t1.GetInverse());
          f31 = new vtkTransformPolyDataFilter();
          f31.SetInputConnection((vtkAlgorithmOutput)ap.GetOutputPort());
          f31.SetTransform((vtkAbstractTransform)t3);
          m31 = new vtkDataSetMapper();
          m31.SetInputConnection((vtkAlgorithmOutput)f31.GetOutputPort());
          a31 = new vtkActor();
          a31.SetMapper((vtkMapper)m31);
          a31.GetProperty().SetColor((double)1,(double)0,(double)0);
          a31.GetProperty().SetRepresentationToWireframe();
          ren31 = vtkRenderer.New();
          ren31.SetViewport((double)0.50,(double)0.5,(double)0.75,(double)1.0);
          ren31.ResetCamera((double)-0.5,(double)0.5,(double)-0.5,(double)0.5,(double)-1,(double)1);
          ren31.AddActor((vtkProp)a31);
          renWin.AddRenderer((vtkRenderer)ren31);
          // inverse linear transform[]
          f32 = new vtkTransformPolyDataFilter();
          f32.SetInputConnection((vtkAlgorithmOutput)ap.GetOutputPort());
          f32.SetTransform((vtkAbstractTransform)t3.GetInverse());
          m32 = new vtkDataSetMapper();
          m32.SetInputConnection((vtkAlgorithmOutput)f32.GetOutputPort());
          a32 = new vtkActor();
          a32.SetMapper((vtkMapper)m32);
          a32.GetProperty().SetColor((double)0.9,(double)0.9,(double)0);
          a32.GetProperty().SetRepresentationToWireframe();
          ren32 = vtkRenderer.New();
          ren32.SetViewport((double)0.5,(double)0.0,(double)0.75,(double)0.5);
          ren32.ResetCamera((double)-0.5,(double)0.5,(double)-0.5,(double)0.5,(double)-1,(double)1);
          ren32.AddActor((vtkProp)a32);
          renWin.AddRenderer((vtkRenderer)ren32);
          //--------------------------[]
          // perspective transform concatenation[]
          t4 = new vtkPerspectiveTransform();
          t4.Concatenate((vtkHomogeneousTransform)t1);
          t4.Concatenate((vtkHomogeneousTransform)t2);
          t4.Concatenate((vtkHomogeneousTransform)t3);
          f41 = new vtkTransformPolyDataFilter();
          f41.SetInputConnection((vtkAlgorithmOutput)ap.GetOutputPort());
          f41.SetTransform((vtkAbstractTransform)t4);
          m41 = new vtkDataSetMapper();
          m41.SetInputConnection((vtkAlgorithmOutput)f41.GetOutputPort());
          a41 = new vtkActor();
          a41.SetMapper((vtkMapper)m41);
          a41.GetProperty().SetColor((double)1,(double)0,(double)0);
          a41.GetProperty().SetRepresentationToWireframe();
          ren41 = vtkRenderer.New();
          ren41.SetViewport((double)0.75,(double)0.5,(double)1.0,(double)1.0);
          ren41.ResetCamera((double)-0.5,(double)0.5,(double)-0.5,(double)0.5,(double)-1,(double)1);
          ren41.AddActor((vtkProp)a41);
          renWin.AddRenderer((vtkRenderer)ren41);
          // inverse of transform concatenation[]
          f42 = new vtkTransformPolyDataFilter();
          f42.SetInputConnection((vtkAlgorithmOutput)ap.GetOutputPort());
          f42.SetTransform((vtkAbstractTransform)t4.GetInverse());
          m42 = new vtkDataSetMapper();
          m42.SetInputConnection((vtkAlgorithmOutput)f42.GetOutputPort());
          a42 = new vtkActor();
          a42.SetMapper((vtkMapper)m42);
          a42.GetProperty().SetColor((double)0.9,(double)0.9,(double)0);
          a42.GetProperty().SetRepresentationToWireframe();
          ren42 = vtkRenderer.New();
          ren42.SetViewport((double)0.75,(double)0.0,(double)1.0,(double)0.5);
          ren42.ResetCamera((double)-0.5,(double)0.5,(double)-0.5,(double)0.5,(double)-1,(double)1);
          ren42.AddActor((vtkProp)a42);
          renWin.AddRenderer((vtkRenderer)ren42);
          renWin.Render();

        //deleteAllVTKObjects();
    }
Exemplo n.º 45
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVcursor3D(String [] argv)
    {
        //Prefix Content is: ""

          // This little example shows how a cursor can be created in []
          // image viewers, and renderers.  The standard TkImageViewerWidget and[]
          // TkRenderWidget bindings are used.  There is a new binding:[]
          // middle button in the image viewer sets the position of the cursor.  []
          // First we include the VTK Tcl packages which will make available []
          // all of the vtk commands to Tcl[]
          // Global values[]
          CURSOR_X = 20;
          CURSOR_Y = 20;
          CURSOR_Z = 20;
          IMAGE_MAG_X = 4;
          IMAGE_MAG_Y = 4;
          IMAGE_MAG_Z = 1;
          // Pipeline stuff[]
          reader = new vtkSLCReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/neghip.slc");
          // Cursor stuff[]
          magnify = new vtkImageMagnify();
          magnify.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          magnify.SetMagnificationFactors((int)IMAGE_MAG_X,(int)IMAGE_MAG_Y,(int)IMAGE_MAG_Z);
          image_cursor = new vtkImageCursor3D();
          image_cursor.SetInputConnection((vtkAlgorithmOutput)magnify.GetOutputPort());
          image_cursor.SetCursorPosition((double)CURSOR_X*IMAGE_MAG_X,(double)CURSOR_Y*IMAGE_MAG_Y,(double)CURSOR_Z*IMAGE_MAG_Z);
          image_cursor.SetCursorValue((double)255);
          image_cursor.SetCursorRadius((int)50*IMAGE_MAG_X);
          axes = new vtkAxes();
          axes.SymmetricOn();
          axes.SetOrigin((double)CURSOR_X,(double)CURSOR_Y,(double)CURSOR_Z);
          axes.SetScaleFactor((double)50.0);
          axes_mapper = vtkPolyDataMapper.New();
          axes_mapper.SetInputConnection((vtkAlgorithmOutput)axes.GetOutputPort());
          axesActor = new vtkActor();
          axesActor.SetMapper((vtkMapper)axes_mapper);
          axesActor.GetProperty().SetAmbient((double)0.5);
          // Image viewer stuff[]
          viewer = new vtkImageViewer();
          viewer.SetInputConnection((vtkAlgorithmOutput)image_cursor.GetOutputPort());
          viewer.SetZSlice((int)CURSOR_Z*IMAGE_MAG_Z);
          viewer.SetColorWindow((double)256);
          viewer.SetColorLevel((double)128);
          //method moved
          //method moved
          //method moved
          // Create transfer functions for opacity and color[]
          opacity_transfer_function = new vtkPiecewiseFunction();
          opacity_transfer_function.AddPoint((double)20,(double)0.0);
          opacity_transfer_function.AddPoint((double)255,(double)0.2);
          color_transfer_function = new vtkColorTransferFunction();
          color_transfer_function.AddRGBPoint((double)0,(double)0,(double)0,(double)0);
          color_transfer_function.AddRGBPoint((double)64,(double)1,(double)0,(double)0);
          color_transfer_function.AddRGBPoint((double)128,(double)0,(double)0,(double)1);
          color_transfer_function.AddRGBPoint((double)192,(double)0,(double)1,(double)0);
          color_transfer_function.AddRGBPoint((double)255,(double)0,(double).2,(double)0);
          // Create properties, mappers, volume actors, and ray cast function[]
          volume_property = new vtkVolumeProperty();
          volume_property.SetColor((vtkColorTransferFunction)color_transfer_function);
          volume_property.SetScalarOpacity((vtkPiecewiseFunction)opacity_transfer_function);
          composite_function = new vtkVolumeRayCastCompositeFunction();
          volume_mapper = new vtkVolumeRayCastMapper();
          volume_mapper.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          volume_mapper.SetVolumeRayCastFunction((vtkVolumeRayCastFunction)composite_function);
          volume = new vtkVolume();
          volume.SetMapper((vtkAbstractVolumeMapper)volume_mapper);
          volume.SetProperty((vtkVolumeProperty)volume_property);
          // Create outline[]
          outline = new vtkOutlineFilter();
          outline.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          outline_mapper = vtkPolyDataMapper.New();
          outline_mapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outline_mapper);
          outlineActor.GetProperty().SetColor((double)1,(double)1,(double)1);
          // Create the renderer[]
          ren1 = vtkRenderer.New();
          ren1.AddActor((vtkProp)axesActor);
          ren1.AddVolume((vtkProp)volume);
          ren1.SetBackground((double)0.1,(double)0.2,(double)0.4);
          renWin2 = vtkRenderWindow.New();
          renWin2.AddRenderer((vtkRenderer)ren1);
          renWin2.SetSize((int)256,(int)256);
          // Create the GUI: two renderer widgets and a quit button[]
          //tk window skipped..
          // Set the window manager (wm command) so that it registers a[]
          // command to handle the WM_DELETE_WINDOW protocal request. This[]
          // request is triggered when the widget is closed using the standard[]
          // window manager icons or buttons. In this case the exit callback[]
          // will be called and it will free up any objects we created then exit[]
          // the application.[]
          // Help label, frame and quit button[]
          //tk window skipped..
          //tk window skipped..
          //tk window skipped..

        //deleteAllVTKObjects();
    }
Exemplo n.º 46
0
    /// <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();
    }
Exemplo n.º 47
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVExtractTensors(String [] argv)
    {
        //Prefix Content is: ""

          // create tensor ellipsoids[]
          // Create the RenderWindow, Renderer and interactive renderer[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          ptLoad = new vtkPointLoad();
          ptLoad.SetLoadValue((double)100.0);
          ptLoad.SetSampleDimensions((int)30,(int)30,(int)30);
          ptLoad.ComputeEffectiveStressOn();
          ptLoad.SetModelBounds((double)-10,(double)10,(double)-10,(double)10,(double)-10,(double)10);
          extractTensor = new vtkExtractTensorComponents();
          extractTensor.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort());
          extractTensor.ScalarIsEffectiveStress();
          extractTensor.ScalarIsComponent();
          extractTensor.ExtractScalarsOn();
          extractTensor.ExtractVectorsOn();
          extractTensor.ExtractNormalsOff();
          extractTensor.ExtractTCoordsOn();
          contour = new vtkContourFilter();
          contour.SetInputConnection((vtkAlgorithmOutput)extractTensor.GetOutputPort());
          contour.SetValue((int)0,(double)0);
          probe = new vtkProbeFilter();
          probe.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort());
          probe.SetSource((vtkDataObject)ptLoad.GetOutput());
          su = new vtkLoopSubdivisionFilter();
          su.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort());
          su.SetNumberOfSubdivisions((int)1);
          s1Mapper = vtkPolyDataMapper.New();
          s1Mapper.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort());
          //    s1Mapper SetInputConnection [su GetOutputPort][]
          s1Actor = new vtkActor();
          s1Actor.SetMapper((vtkMapper)s1Mapper);
          //[]
          // plane for context[]
          //[]
          g = new vtkImageDataGeometryFilter();
          g.SetInputConnection((vtkAlgorithmOutput)ptLoad.GetOutputPort());
          g.SetExtent((int)0,(int)100,(int)0,(int)100,(int)0,(int)0);
          g.Update();
          //for scalar range[]
          gm = vtkPolyDataMapper.New();
          gm.SetInputConnection((vtkAlgorithmOutput)g.GetOutputPort());
          gm.SetScalarRange((double)((vtkDataSet)g.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)g.GetOutput()).GetScalarRange()[1]);
          ga = new vtkActor();
          ga.SetMapper((vtkMapper)gm);
          s1Mapper.SetScalarRange((double)((vtkDataSet)g.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)g.GetOutput()).GetScalarRange()[1]);
          //[]
          // Create outline around data[]
          //[]
          outline = new vtkOutlineFilter();
          outline.SetInputConnection((vtkAlgorithmOutput)ptLoad.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);
          //[]
          // Create cone indicating application of load[]
          //[]
          coneSrc = new vtkConeSource();
          coneSrc.SetRadius((double).5);
          coneSrc.SetHeight((double)2);
          coneMap = vtkPolyDataMapper.New();
          coneMap.SetInputConnection((vtkAlgorithmOutput)coneSrc.GetOutputPort());
          coneActor = new vtkActor();
          coneActor.SetMapper((vtkMapper)coneMap);
          coneActor.SetPosition((double)0,(double)0,(double)11);
          coneActor.RotateY((double)90);
          coneActor.GetProperty().SetColor((double)1,(double)0,(double)0);
          camera = new vtkCamera();
          camera.SetFocalPoint((double)0.113766,(double)-1.13665,(double)-1.01919);
          camera.SetPosition((double)-29.4886,(double)-63.1488,(double)26.5807);
          camera.SetViewAngle((double)24.4617);
          camera.SetViewUp((double)0.17138,(double)0.331163,(double)0.927879);
          camera.SetClippingRange((double)1,(double)100);
          ren1.AddActor((vtkProp)s1Actor);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)coneActor);
          ren1.AddActor((vtkProp)ga);
          ren1.SetBackground((double)1.0,(double)1.0,(double)1.0);
          ren1.SetActiveCamera((vtkCamera)camera);
          renWin.SetSize((int)300,(int)300);
          renWin.Render();
          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
Exemplo n.º 48
0
    /// <summary>
    /// Entry Point
    /// </summary>
    /// <param name="argv"></param>
    public static void Main(String[] argv)
    {
        // This example demonstrates how to use 2D Delaunay triangulation.
        // We create a fancy image of a 2D Delaunay triangulation. Points are
        // randomly generated.
        // first we load in the standard vtk packages into tcl
        // Generate some random points
        math = vtkMath.New();
        points = vtkPoints.New();
        for(int i = 0; i < 50; i++)
        {
            points.InsertPoint(i, vtkMath.Random(0, 1), vtkMath.Random(0, 1), 0.0);
        }

        // Create a polydata with the points we just created.
        profile = vtkPolyData.New();
        profile.SetPoints(points);

        // Perform a 2D Delaunay triangulation on them.
        del = vtkDelaunay2D.New();
        del.SetInput(profile);
        del.SetTolerance(0.001);

        mapMesh = vtkPolyDataMapper.New();
        mapMesh.SetInputConnection(del.GetOutputPort());

        meshActor = vtkActor.New();
        meshActor.SetMapper(mapMesh);
        meshActor.GetProperty().SetColor(.1, .2, .4);

        // We will now create a nice looking mesh by wrapping the edges in tubes,
        // and putting fat spheres at the points.
        extract = vtkExtractEdges.New();
        extract.SetInputConnection(del.GetOutputPort());

        tubes = vtkTubeFilter.New();
        tubes.SetInputConnection(extract.GetOutputPort());
        tubes.SetRadius(0.01);
        tubes.SetNumberOfSides(6);

        mapEdges = vtkPolyDataMapper.New();
        mapEdges.SetInputConnection(tubes.GetOutputPort());

        edgeActor = vtkActor.New();
        edgeActor.SetMapper(mapEdges);
        edgeActor.GetProperty().SetColor(0.2000, 0.6300, 0.7900);
        edgeActor.GetProperty().SetSpecularColor(1, 1, 1);
        edgeActor.GetProperty().SetSpecular(0.3);
        edgeActor.GetProperty().SetSpecularPower(20);
        edgeActor.GetProperty().SetAmbient(0.2);
        edgeActor.GetProperty().SetDiffuse(0.8);

        ball = vtkSphereSource.New();
        ball.SetRadius(0.025);
        ball.SetThetaResolution(12);
        ball.SetPhiResolution(12);

        balls = vtkGlyph3D.New();
        balls.SetInputConnection(del.GetOutputPort());
        balls.SetSourceConnection(ball.GetOutputPort());

        mapBalls = vtkPolyDataMapper.New();
        mapBalls.SetInputConnection(balls.GetOutputPort());

        ballActor = vtkActor.New();
        ballActor.SetMapper(mapBalls);
        ballActor.GetProperty().SetColor(1.0000, 0.4118, 0.7059);
        ballActor.GetProperty().SetSpecularColor(1, 1, 1);
        ballActor.GetProperty().SetSpecular(0.3);
        ballActor.GetProperty().SetSpecularPower(20);
        ballActor.GetProperty().SetAmbient(0.2);
        ballActor.GetProperty().SetDiffuse(0.8);

        // Create graphics objects
        // Create the rendering window, renderer, and interactive renderer
        ren1 = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.AddRenderer(ren1);
        iren = vtkRenderWindowInteractor.New();
        iren.SetRenderWindow(renWin);

        // Add the actors to the renderer, set the background and size
        ren1.AddActor(ballActor);
        ren1.AddActor(edgeActor);
        ren1.SetBackground(1, 1, 1);
        renWin.SetSize(150, 150);

        // render the image
        ren1.ResetCamera();
        ren1.GetActiveCamera().Zoom(1.5);
        iren.Initialize();
        iren.Start();

        // Clean Up
        deleteAllVTKObjects();
    }
Exemplo n.º 49
0
 public cGeometric3DObject(vtkActor CurrentActor, Color NewColor)
 {
     CurrentActor.GetProperty().SetColor(NewColor.R / 255.0, NewColor.G / 255.0, NewColor.B / 255.0);
     vtk_Actor = CurrentActor;
     //vtk_Actor.SetPickable(0);
     ObjectType = "Geometrical";
 }
Exemplo n.º 50
0
        public Simulation(vtkRenderWindow renderWindow)
        {
            RenderWindow = renderWindow;
            Renderer = renderWindow.GetRenderers().GetFirstRenderer();

            //Background
            Renderer.GradientBackgroundOn();
            Renderer.SetBackground((double)colorBackground.R / 255, (double)colorBackground.G / 255, (double)colorBackground.B / 255);
            Renderer.SetBackground2((double)colorBackground2.R / 255, (double)colorBackground2.G / 255, (double)colorBackground2.B / 255);

            //Base
            baseAxes.SetTotalLength(200, 200, 200);
            baseAxes.AxisLabelsOff();
            Renderer.AddActor(baseAxes);

            //Floor
            vtkPlaneSource planeSource = vtkPlaneSource.New();
            planeSource.SetOrigin(-1000.0, -1000.0, 0);
            planeSource.SetPoint1(-1000.0, 1000.0, 0);
            planeSource.SetPoint2(1000.0, -1000.0, 0);
            planeSource.Update();
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
            vtkPolyData plane = planeSource.GetOutput();
            mapper.SetInput(plane);
            floor = vtkActor.New();
            floor.SetMapper(mapper);
            floor.GetProperty().SetColor(0.8, 0.8, 0.8);
            Renderer.AddActor(floor);

            //Robot1
            robot1Pos = new Position(-500, 0, 0, 0, 0, 0);
            //Robots.Robot1.Base = new Position(-500, 0, 0, 0, 0, 0);

            robot1part1 = LoadSTL(robot1part1, @"\Robot\agilus_00.stl", Color.FromArgb(25, 25, 25));
            robot1part2 = LoadSTL(robot1part2, @"\Robot\agilus_01.stl", Color.FromArgb(255, 110, 0));
            robot1part3 = LoadSTL(robot1part3, @"\Robot\agilus_02.stl", Color.FromArgb(255, 110, 0));
            robot1part4 = LoadSTL(robot1part4, @"\Robot\agilus_03.stl", Color.FromArgb(255, 110, 0));
            robot1part5 = LoadSTL(robot1part5, @"\Robot\agilus_04.stl", Color.FromArgb(255, 110, 0));
            robot1part6 = LoadSTL(robot1part6, @"\Robot\agilus_05.stl", Color.FromArgb(255, 110, 0));
            robot1part7 = LoadSTL(robot1part6, @"\Robot\agilus_06.stl", Color.DarkGray);
            robot1part1.SetPosition(robot1Pos.X, robot1Pos.Y, robot1Pos.Z);
            Renderer.AddActor(robot1part1);
            Renderer.AddActor(robot1part2);
            Renderer.AddActor(robot1part3);
            Renderer.AddActor(robot1part4);
            Renderer.AddActor(robot1part5);
            Renderer.AddActor(robot1part6);
            Renderer.AddActor(robot1part7);
            robot1axes1.SetTotalLength(200, 200, 200);
            robot1axes1.AxisLabelsOff();
            Renderer.AddActor(robot1axes1);
            robot1axes2.SetTotalLength(200, 200, 200);
            robot1axes2.AxisLabelsOff();
            Renderer.AddActor(robot1axes2);
            robot1axes3.SetTotalLength(200, 200, 200);
            robot1axes3.AxisLabelsOff();
            Renderer.AddActor(robot1axes3);
            robot1axes4.SetTotalLength(200, 200, 200);
            robot1axes4.AxisLabelsOff();
            Renderer.AddActor(robot1axes4);
            robot1axes5.SetTotalLength(200, 200, 200);
            robot1axes5.AxisLabelsOff();
            Renderer.AddActor(robot1axes5);
            robot1axes6.SetTotalLength(200, 200, 200);
            robot1axes6.AxisLabelsOff();
            Renderer.AddActor(robot1axes6);

            //Robot2
            robot2Pos = new Position(1000, 0, 0, 0, 0, 0);
            Robots.Robot2.Base = robot2Pos;
            robot2part1 = LoadSTL(robot2part1, @"\Robot\agilus_00.stl", Color.FromArgb(25, 25, 25));
            robot2part2 = LoadSTL(robot2part2, @"\Robot\agilus_01.stl", Color.FromArgb(255, 110, 0));
            robot2part3 = LoadSTL(robot2part3, @"\Robot\agilus_02.stl", Color.FromArgb(255, 110, 0));
            robot2part4 = LoadSTL(robot2part4, @"\Robot\agilus_03.stl", Color.FromArgb(255, 110, 0));
            robot2part5 = LoadSTL(robot2part5, @"\Robot\agilus_04.stl", Color.FromArgb(255, 110, 0));
            robot2part6 = LoadSTL(robot2part6, @"\Robot\agilus_05.stl", Color.FromArgb(255, 110, 0));
            robot2part7 = LoadSTL(robot2part6, @"\Robot\agilus_06.stl", Color.DarkGray);
            robot2part1.SetPosition(Robots.Robot2.Base.X, Robots.Robot2.Base.Y, Robots.Robot2.Base.Z);
            Renderer.AddActor(robot2part1);
            Renderer.AddActor(robot2part2);
            Renderer.AddActor(robot2part3);
            Renderer.AddActor(robot2part4);
            Renderer.AddActor(robot2part5);
            Renderer.AddActor(robot2part6);
            Renderer.AddActor(robot2part7);
            robot2axes1.SetTotalLength(200, 200, 200);
            robot2axes1.AxisLabelsOff();
            Renderer.AddActor(robot2axes1);
            robot2axes2.SetTotalLength(200, 200, 200);
            robot2axes2.AxisLabelsOff();
            Renderer.AddActor(robot2axes2);
            robot2axes3.SetTotalLength(200, 200, 200);
            robot2axes3.AxisLabelsOff();
            Renderer.AddActor(robot2axes3);
            robot2axes4.SetTotalLength(200, 200, 200);
            robot2axes4.AxisLabelsOff();
            Renderer.AddActor(robot2axes4);
            robot2axes5.SetTotalLength(200, 200, 200);
            robot2axes5.AxisLabelsOff();
            Renderer.AddActor(robot2axes5);
            robot2axes6.SetTotalLength(200, 200, 200);
            robot2axes6.AxisLabelsOff();
            Renderer.AddActor(robot2axes6);

            Renderer.AddActor(drawPointCloud());
            Renderer.Render();

            worker.DoWork += worker_DoWork;
            worker.RunWorkerAsync();
        }
    /// <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 AVLineIntersectQuadraticCells(String [] argv)
    {
        //Prefix Content is: ""

          // Contour every quadratic cell type[]
          // Create a scene with one of each cell type.[]
          // QuadraticEdge[]
          edgePoints = new vtkPoints();
          edgePoints.SetNumberOfPoints((int)3);
          edgePoints.InsertPoint((int)0,(double)0,(double)0,(double)0);
          edgePoints.InsertPoint((int)1,(double)1.0,(double)0,(double)0);
          edgePoints.InsertPoint((int)2,(double)0.5,(double)0.25,(double)0);
          edgeScalars = new vtkFloatArray();
          edgeScalars.SetNumberOfTuples((int)3);
          edgeScalars.InsertValue((int)0,(float)0.0);
          edgeScalars.InsertValue((int)1,(float)0.0);
          edgeScalars.InsertValue((int)2,(float)0.9);
          aEdge = new vtkQuadraticEdge();
          aEdge.GetPointIds().SetId((int)0,(int)0);
          aEdge.GetPointIds().SetId((int)1,(int)1);
          aEdge.GetPointIds().SetId((int)2,(int)2);
          aEdgeGrid = new vtkUnstructuredGrid();
          aEdgeGrid.Allocate((int)1,(int)1);
          aEdgeGrid.InsertNextCell((int)aEdge.GetCellType(),(vtkIdList)aEdge.GetPointIds());
          aEdgeGrid.SetPoints((vtkPoints)edgePoints);
          aEdgeGrid.GetPointData().SetScalars((vtkDataArray)edgeScalars);
          aEdgeMapper = new vtkDataSetMapper();
          aEdgeMapper.SetInputData((vtkDataSet)aEdgeGrid);
          aEdgeMapper.ScalarVisibilityOff();
          aEdgeActor = new vtkActor();
          aEdgeActor.SetMapper((vtkMapper)aEdgeMapper);
          aEdgeActor.GetProperty().SetRepresentationToWireframe();
          aEdgeActor.GetProperty().SetAmbient((double)1.0);
          // Quadratic triangle[]
          triPoints = new vtkPoints();
          triPoints.SetNumberOfPoints((int)6);
          triPoints.InsertPoint((int)0,(double)0.0,(double)0.0,(double)0.0);
          triPoints.InsertPoint((int)1,(double)1.0,(double)0.0,(double)0.0);
          triPoints.InsertPoint((int)2,(double)0.5,(double)0.8,(double)0.0);
          triPoints.InsertPoint((int)3,(double)0.5,(double)0.0,(double)0.0);
          triPoints.InsertPoint((int)4,(double)0.75,(double)0.4,(double)0.0);
          triPoints.InsertPoint((int)5,(double)0.25,(double)0.4,(double)0.0);
          triScalars = new vtkFloatArray();
          triScalars.SetNumberOfTuples((int)6);
          triScalars.InsertValue((int)0,(float)0.0);
          triScalars.InsertValue((int)1,(float)0.0);
          triScalars.InsertValue((int)2,(float)0.0);
          triScalars.InsertValue((int)3,(float)1.0);
          triScalars.InsertValue((int)4,(float)0.0);
          triScalars.InsertValue((int)5,(float)0.0);
          aTri = new vtkQuadraticTriangle();
          aTri.GetPointIds().SetId((int)0,(int)0);
          aTri.GetPointIds().SetId((int)1,(int)1);
          aTri.GetPointIds().SetId((int)2,(int)2);
          aTri.GetPointIds().SetId((int)3,(int)3);
          aTri.GetPointIds().SetId((int)4,(int)4);
          aTri.GetPointIds().SetId((int)5,(int)5);
          aTriGrid = new vtkUnstructuredGrid();
          aTriGrid.Allocate((int)1,(int)1);
          aTriGrid.InsertNextCell((int)aTri.GetCellType(),(vtkIdList)aTri.GetPointIds());
          aTriGrid.SetPoints((vtkPoints)triPoints);
          aTriGrid.GetPointData().SetScalars((vtkDataArray)triScalars);
          aTriMapper = new vtkDataSetMapper();
          aTriMapper.SetInputData((vtkDataSet)aTriGrid);
          aTriMapper.ScalarVisibilityOff();
          aTriActor = new vtkActor();
          aTriActor.SetMapper((vtkMapper)aTriMapper);
          aTriActor.GetProperty().SetRepresentationToWireframe();
          aTriActor.GetProperty().SetAmbient((double)1.0);
          // Quadratic quadrilateral[]
          quadPoints = new vtkPoints();
          quadPoints.SetNumberOfPoints((int)8);
          quadPoints.InsertPoint((int)0,(double)0.0,(double)0.0,(double)0.0);
          quadPoints.InsertPoint((int)1,(double)1.0,(double)0.0,(double)0.0);
          quadPoints.InsertPoint((int)2,(double)1.0,(double)1.0,(double)0.0);
          quadPoints.InsertPoint((int)3,(double)0.0,(double)1.0,(double)0.0);
          quadPoints.InsertPoint((int)4,(double)0.5,(double)0.0,(double)0.0);
          quadPoints.InsertPoint((int)5,(double)1.0,(double)0.5,(double)0.0);
          quadPoints.InsertPoint((int)6,(double)0.5,(double)1.0,(double)0.0);
          quadPoints.InsertPoint((int)7,(double)0.0,(double)0.5,(double)0.0);
          quadScalars = new vtkFloatArray();
          quadScalars.SetNumberOfTuples((int)8);
          quadScalars.InsertValue((int)0,(float)0.0);
          quadScalars.InsertValue((int)1,(float)0.0);
          quadScalars.InsertValue((int)2,(float)1.0);
          quadScalars.InsertValue((int)3,(float)1.0);
          quadScalars.InsertValue((int)4,(float)1.0);
          quadScalars.InsertValue((int)5,(float)0.0);
          quadScalars.InsertValue((int)6,(float)0.0);
          quadScalars.InsertValue((int)7,(float)0.0);
          aQuad = new vtkQuadraticQuad();
          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);
          aQuad.GetPointIds().SetId((int)4,(int)4);
          aQuad.GetPointIds().SetId((int)5,(int)5);
          aQuad.GetPointIds().SetId((int)6,(int)6);
          aQuad.GetPointIds().SetId((int)7,(int)7);
          aQuadGrid = new vtkUnstructuredGrid();
          aQuadGrid.Allocate((int)1,(int)1);
          aQuadGrid.InsertNextCell((int)aQuad.GetCellType(),(vtkIdList)aQuad.GetPointIds());
          aQuadGrid.SetPoints((vtkPoints)quadPoints);
          aQuadGrid.GetPointData().SetScalars((vtkDataArray)quadScalars);
          aQuadMapper = new vtkDataSetMapper();
          aQuadMapper.SetInputData((vtkDataSet)aQuadGrid);
          aQuadMapper.ScalarVisibilityOff();
          aQuadActor = new vtkActor();
          aQuadActor.SetMapper((vtkMapper)aQuadMapper);
          aQuadActor.GetProperty().SetRepresentationToWireframe();
          aQuadActor.GetProperty().SetAmbient((double)1.0);
          // Quadratic tetrahedron[]
          tetPoints = new vtkPoints();
          tetPoints.SetNumberOfPoints((int)10);
          tetPoints.InsertPoint((int)0,(double)0.0,(double)0.0,(double)0.0);
          tetPoints.InsertPoint((int)1,(double)1.0,(double)0.0,(double)0.0);
          tetPoints.InsertPoint((int)2,(double)0.5,(double)0.8,(double)0.0);
          tetPoints.InsertPoint((int)3,(double)0.5,(double)0.4,(double)1.0);
          tetPoints.InsertPoint((int)4,(double)0.5,(double)0.0,(double)0.0);
          tetPoints.InsertPoint((int)5,(double)0.75,(double)0.4,(double)0.0);
          tetPoints.InsertPoint((int)6,(double)0.25,(double)0.4,(double)0.0);
          tetPoints.InsertPoint((int)7,(double)0.25,(double)0.2,(double)0.5);
          tetPoints.InsertPoint((int)8,(double)0.75,(double)0.2,(double)0.5);
          tetPoints.InsertPoint((int)9,(double)0.50,(double)0.6,(double)0.5);
          tetScalars = new vtkFloatArray();
          tetScalars.SetNumberOfTuples((int)10);
          tetScalars.InsertValue((int)0,(float)1.0);
          tetScalars.InsertValue((int)1,(float)1.0);
          tetScalars.InsertValue((int)2,(float)1.0);
          tetScalars.InsertValue((int)3,(float)1.0);
          tetScalars.InsertValue((int)4,(float)0.0);
          tetScalars.InsertValue((int)5,(float)0.0);
          tetScalars.InsertValue((int)6,(float)0.0);
          tetScalars.InsertValue((int)7,(float)0.0);
          tetScalars.InsertValue((int)8,(float)0.0);
          tetScalars.InsertValue((int)9,(float)0.0);
          aTet = new vtkQuadraticTetra();
          aTet.GetPointIds().SetId((int)0,(int)0);
          aTet.GetPointIds().SetId((int)1,(int)1);
          aTet.GetPointIds().SetId((int)2,(int)2);
          aTet.GetPointIds().SetId((int)3,(int)3);
          aTet.GetPointIds().SetId((int)4,(int)4);
          aTet.GetPointIds().SetId((int)5,(int)5);
          aTet.GetPointIds().SetId((int)6,(int)6);
          aTet.GetPointIds().SetId((int)7,(int)7);
          aTet.GetPointIds().SetId((int)8,(int)8);
          aTet.GetPointIds().SetId((int)9,(int)9);
          aTetGrid = new vtkUnstructuredGrid();
          aTetGrid.Allocate((int)1,(int)1);
          aTetGrid.InsertNextCell((int)aTet.GetCellType(),(vtkIdList)aTet.GetPointIds());
          aTetGrid.SetPoints((vtkPoints)tetPoints);
          aTetGrid.GetPointData().SetScalars((vtkDataArray)tetScalars);
          aTetMapper = new vtkDataSetMapper();
          aTetMapper.SetInputData((vtkDataSet)aTetGrid);
          aTetMapper.ScalarVisibilityOff();
          aTetActor = new vtkActor();
          aTetActor.SetMapper((vtkMapper)aTetMapper);
          aTetActor.GetProperty().SetRepresentationToWireframe();
          aTetActor.GetProperty().SetAmbient((double)1.0);
          // Quadratic hexahedron[]
          hexPoints = new vtkPoints();
          hexPoints.SetNumberOfPoints((int)20);
          hexPoints.InsertPoint((int)0,(double)0,(double)0,(double)0);
          hexPoints.InsertPoint((int)1,(double)1,(double)0,(double)0);
          hexPoints.InsertPoint((int)2,(double)1,(double)1,(double)0);
          hexPoints.InsertPoint((int)3,(double)0,(double)1,(double)0);
          hexPoints.InsertPoint((int)4,(double)0,(double)0,(double)1);
          hexPoints.InsertPoint((int)5,(double)1,(double)0,(double)1);
          hexPoints.InsertPoint((int)6,(double)1,(double)1,(double)1);
          hexPoints.InsertPoint((int)7,(double)0,(double)1,(double)1);
          hexPoints.InsertPoint((int)8,(double)0.5,(double)0,(double)0);
          hexPoints.InsertPoint((int)9,(double)1,(double)0.5,(double)0);
          hexPoints.InsertPoint((int)10,(double)0.5,(double)1,(double)0);
          hexPoints.InsertPoint((int)11,(double)0,(double)0.5,(double)0);
          hexPoints.InsertPoint((int)12,(double)0.5,(double)0,(double)1);
          hexPoints.InsertPoint((int)13,(double)1,(double)0.5,(double)1);
          hexPoints.InsertPoint((int)14,(double)0.5,(double)1,(double)1);
          hexPoints.InsertPoint((int)15,(double)0,(double)0.5,(double)1);
          hexPoints.InsertPoint((int)16,(double)0,(double)0,(double)0.5);
          hexPoints.InsertPoint((int)17,(double)1,(double)0,(double)0.5);
          hexPoints.InsertPoint((int)18,(double)1,(double)1,(double)0.5);
          hexPoints.InsertPoint((int)19,(double)0,(double)1,(double)0.5);
          hexScalars = new vtkFloatArray();
          hexScalars.SetNumberOfTuples((int)20);
          hexScalars.InsertValue((int)0,(float)1.0);
          hexScalars.InsertValue((int)1,(float)1.0);
          hexScalars.InsertValue((int)2,(float)1.0);
          hexScalars.InsertValue((int)3,(float)1.0);
          hexScalars.InsertValue((int)4,(float)1.0);
          hexScalars.InsertValue((int)5,(float)1.0);
          hexScalars.InsertValue((int)6,(float)1.0);
          hexScalars.InsertValue((int)7,(float)1.0);
          hexScalars.InsertValue((int)8,(float)0.0);
          hexScalars.InsertValue((int)9,(float)0.0);
          hexScalars.InsertValue((int)10,(float)0.0);
          hexScalars.InsertValue((int)11,(float)0.0);
          hexScalars.InsertValue((int)12,(float)0.0);
          hexScalars.InsertValue((int)13,(float)0.0);
          hexScalars.InsertValue((int)14,(float)0.0);
          hexScalars.InsertValue((int)15,(float)0.0);
          hexScalars.InsertValue((int)16,(float)0.0);
          hexScalars.InsertValue((int)17,(float)0.0);
          hexScalars.InsertValue((int)18,(float)0.0);
          hexScalars.InsertValue((int)19,(float)0.0);
          aHex = new vtkQuadraticHexahedron();
          aHex.GetPointIds().SetId((int)0,(int)0);
          aHex.GetPointIds().SetId((int)1,(int)1);
          aHex.GetPointIds().SetId((int)2,(int)2);
          aHex.GetPointIds().SetId((int)3,(int)3);
          aHex.GetPointIds().SetId((int)4,(int)4);
          aHex.GetPointIds().SetId((int)5,(int)5);
          aHex.GetPointIds().SetId((int)6,(int)6);
          aHex.GetPointIds().SetId((int)7,(int)7);
          aHex.GetPointIds().SetId((int)8,(int)8);
          aHex.GetPointIds().SetId((int)9,(int)9);
          aHex.GetPointIds().SetId((int)10,(int)10);
          aHex.GetPointIds().SetId((int)11,(int)11);
          aHex.GetPointIds().SetId((int)12,(int)12);
          aHex.GetPointIds().SetId((int)13,(int)13);
          aHex.GetPointIds().SetId((int)14,(int)14);
          aHex.GetPointIds().SetId((int)15,(int)15);
          aHex.GetPointIds().SetId((int)16,(int)16);
          aHex.GetPointIds().SetId((int)17,(int)17);
          aHex.GetPointIds().SetId((int)18,(int)18);
          aHex.GetPointIds().SetId((int)19,(int)19);
          aHexGrid = new vtkUnstructuredGrid();
          aHexGrid.Allocate((int)1,(int)1);
          aHexGrid.InsertNextCell((int)aHex.GetCellType(),(vtkIdList)aHex.GetPointIds());
          aHexGrid.SetPoints((vtkPoints)hexPoints);
          aHexGrid.GetPointData().SetScalars((vtkDataArray)hexScalars);
          aHexMapper = new vtkDataSetMapper();
          aHexMapper.SetInputData((vtkDataSet)aHexGrid);
          aHexMapper.ScalarVisibilityOff();
          aHexActor = new vtkActor();
          aHexActor.SetMapper((vtkMapper)aHexMapper);
          aHexActor.GetProperty().SetRepresentationToWireframe();
          aHexActor.GetProperty().SetAmbient((double)1.0);
          // Quadratic wedge[]
          wedgePoints = new vtkPoints();
          wedgePoints.SetNumberOfPoints((int)15);
          wedgePoints.InsertPoint((int)0,(double)0,(double)0,(double)0);
          wedgePoints.InsertPoint((int)1,(double)1,(double)0,(double)0);
          wedgePoints.InsertPoint((int)2,(double)0,(double)1,(double)0);
          wedgePoints.InsertPoint((int)3,(double)0,(double)0,(double)1);
          wedgePoints.InsertPoint((int)4,(double)1,(double)0,(double)1);
          wedgePoints.InsertPoint((int)5,(double)0,(double)1,(double)1);
          wedgePoints.InsertPoint((int)6,(double)0.5,(double)0,(double)0);
          wedgePoints.InsertPoint((int)7,(double)0.5,(double)0.5,(double)0);
          wedgePoints.InsertPoint((int)8,(double)0,(double)0.5,(double)0);
          wedgePoints.InsertPoint((int)9,(double)0.5,(double)0,(double)1);
          wedgePoints.InsertPoint((int)10,(double)0.5,(double)0.5,(double)1);
          wedgePoints.InsertPoint((int)11,(double)0,(double)0.5,(double)1);
          wedgePoints.InsertPoint((int)12,(double)0,(double)0,(double)0.5);
          wedgePoints.InsertPoint((int)13,(double)1,(double)0,(double)0.5);
          wedgePoints.InsertPoint((int)14,(double)0,(double)1,(double)0.5);
          wedgeScalars = new vtkFloatArray();
          wedgeScalars.SetNumberOfTuples((int)15);
          wedgeScalars.InsertValue((int)0,(float)1.0);
          wedgeScalars.InsertValue((int)1,(float)1.0);
          wedgeScalars.InsertValue((int)2,(float)1.0);
          wedgeScalars.InsertValue((int)3,(float)1.0);
          wedgeScalars.InsertValue((int)4,(float)1.0);
          wedgeScalars.InsertValue((int)5,(float)1.0);
          wedgeScalars.InsertValue((int)6,(float)1.0);
          wedgeScalars.InsertValue((int)7,(float)1.0);
          wedgeScalars.InsertValue((int)8,(float)0.0);
          wedgeScalars.InsertValue((int)9,(float)0.0);
          wedgeScalars.InsertValue((int)10,(float)0.0);
          wedgeScalars.InsertValue((int)11,(float)0.0);
          wedgeScalars.InsertValue((int)12,(float)0.0);
          wedgeScalars.InsertValue((int)13,(float)0.0);
          wedgeScalars.InsertValue((int)14,(float)0.0);
          aWedge = new vtkQuadraticWedge();
          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);
          aWedge.GetPointIds().SetId((int)6,(int)6);
          aWedge.GetPointIds().SetId((int)7,(int)7);
          aWedge.GetPointIds().SetId((int)8,(int)8);
          aWedge.GetPointIds().SetId((int)9,(int)9);
          aWedge.GetPointIds().SetId((int)10,(int)10);
          aWedge.GetPointIds().SetId((int)11,(int)11);
          aWedge.GetPointIds().SetId((int)12,(int)12);
          aWedge.GetPointIds().SetId((int)13,(int)13);
          aWedge.GetPointIds().SetId((int)14,(int)14);
          aWedgeGrid = new vtkUnstructuredGrid();
          aWedgeGrid.Allocate((int)1,(int)1);
          aWedgeGrid.InsertNextCell((int)aWedge.GetCellType(),(vtkIdList)aWedge.GetPointIds());
          aWedgeGrid.SetPoints((vtkPoints)wedgePoints);
          aWedgeGrid.GetPointData().SetScalars((vtkDataArray)wedgeScalars);
          wedgeContours = new vtkClipDataSet();
          wedgeContours.SetInputData((vtkDataObject)aWedgeGrid);
          wedgeContours.SetValue((double)0.5);
          aWedgeContourMapper = new vtkDataSetMapper();
          aWedgeContourMapper.SetInputConnection((vtkAlgorithmOutput)wedgeContours.GetOutputPort());
          aWedgeContourMapper.ScalarVisibilityOff();
          aWedgeMapper = new vtkDataSetMapper();
          aWedgeMapper.SetInputData((vtkDataSet)aWedgeGrid);
          aWedgeMapper.ScalarVisibilityOff();
          aWedgeActor = new vtkActor();
          aWedgeActor.SetMapper((vtkMapper)aWedgeMapper);
          aWedgeActor.GetProperty().SetRepresentationToWireframe();
          aWedgeActor.GetProperty().SetAmbient((double)1.0);
          aWedgeContourActor = new vtkActor();
          aWedgeContourActor.SetMapper((vtkMapper)aWedgeContourMapper);
          aWedgeContourActor.GetProperty().SetAmbient((double)1.0);
          // Quadratic pyramid[]
          pyraPoints = new vtkPoints();
          pyraPoints.SetNumberOfPoints((int)13);
          pyraPoints.InsertPoint((int)0,(double)0,(double)0,(double)0);
          pyraPoints.InsertPoint((int)1,(double)1,(double)0,(double)0);
          pyraPoints.InsertPoint((int)2,(double)1,(double)1,(double)0);
          pyraPoints.InsertPoint((int)3,(double)0,(double)1,(double)0);
          pyraPoints.InsertPoint((int)4,(double)0,(double)0,(double)1);
          pyraPoints.InsertPoint((int)5,(double)0.5,(double)0,(double)0);
          pyraPoints.InsertPoint((int)6,(double)1,(double)0.5,(double)0);
          pyraPoints.InsertPoint((int)7,(double)0.5,(double)1,(double)0);
          pyraPoints.InsertPoint((int)8,(double)0,(double)0.5,(double)0);
          pyraPoints.InsertPoint((int)9,(double)0,(double)0,(double)0.5);
          pyraPoints.InsertPoint((int)10,(double)0.5,(double)0,(double)0.5);
          pyraPoints.InsertPoint((int)11,(double)0.5,(double)0.5,(double)0.5);
          pyraPoints.InsertPoint((int)12,(double)0,(double)0.5,(double)0.5);
          pyraScalars = new vtkFloatArray();
          pyraScalars.SetNumberOfTuples((int)13);
          pyraScalars.InsertValue((int)0,(float)1.0);
          pyraScalars.InsertValue((int)1,(float)1.0);
          pyraScalars.InsertValue((int)2,(float)1.0);
          pyraScalars.InsertValue((int)3,(float)1.0);
          pyraScalars.InsertValue((int)4,(float)1.0);
          pyraScalars.InsertValue((int)5,(float)1.0);
          pyraScalars.InsertValue((int)6,(float)1.0);
          pyraScalars.InsertValue((int)7,(float)1.0);
          pyraScalars.InsertValue((int)8,(float)0.0);
          pyraScalars.InsertValue((int)9,(float)0.0);
          pyraScalars.InsertValue((int)10,(float)0.0);
          pyraScalars.InsertValue((int)11,(float)0.0);
          pyraScalars.InsertValue((int)12,(float)0.0);
          aPyramid = new vtkQuadraticPyramid();
          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);
          aPyramid.GetPointIds().SetId((int)5,(int)5);
          aPyramid.GetPointIds().SetId((int)6,(int)6);
          aPyramid.GetPointIds().SetId((int)7,(int)7);
          aPyramid.GetPointIds().SetId((int)8,(int)8);
          aPyramid.GetPointIds().SetId((int)9,(int)9);
          aPyramid.GetPointIds().SetId((int)10,(int)10);
          aPyramid.GetPointIds().SetId((int)11,(int)11);
          aPyramid.GetPointIds().SetId((int)12,(int)12);
          aPyramidGrid = new vtkUnstructuredGrid();
          aPyramidGrid.Allocate((int)1,(int)1);
          aPyramidGrid.InsertNextCell((int)aPyramid.GetCellType(),(vtkIdList)aPyramid.GetPointIds());
          aPyramidGrid.SetPoints((vtkPoints)pyraPoints);
          aPyramidGrid.GetPointData().SetScalars((vtkDataArray)pyraScalars);
          pyraContours = new vtkClipDataSet();
          pyraContours.SetInputData((vtkDataObject)aPyramidGrid);
          pyraContours.SetValue((double)0.5);
          aPyramidContourMapper = new vtkDataSetMapper();
          aPyramidContourMapper.SetInputConnection((vtkAlgorithmOutput)pyraContours.GetOutputPort());
          aPyramidContourMapper.ScalarVisibilityOff();
          aPyramidMapper = new vtkDataSetMapper();
          aPyramidMapper.SetInputData((vtkDataSet)aPyramidGrid);
          aPyramidMapper.ScalarVisibilityOff();
          aPyramidActor = new vtkActor();
          aPyramidActor.SetMapper((vtkMapper)aPyramidMapper);
          aPyramidActor.GetProperty().SetRepresentationToWireframe();
          aPyramidActor.GetProperty().SetAmbient((double)1.0);
          aPyramidContourActor = new vtkActor();
          aPyramidContourActor.SetMapper((vtkMapper)aPyramidContourMapper);
          aPyramidContourActor.GetProperty().SetAmbient((double)1.0);
          // Create the rendering related stuff.[]
          // Since some of our actors are a single vertex, we need to remove all[]
          // cullers so the single vertex actors will render[]
          ren1 = vtkRenderer.New();
          ren1.GetCullers().RemoveAllItems();
          renWin = vtkRenderWindow.New();
          renWin.SetMultiSamples(0);
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          ren1.SetBackground((double).1,(double).2,(double).3);
          renWin.SetSize((int)400,(int)200);
          // specify properties[]
          ren1.AddActor((vtkProp)aEdgeActor);
          ren1.AddActor((vtkProp)aTriActor);
          ren1.AddActor((vtkProp)aQuadActor);
          ren1.AddActor((vtkProp)aTetActor);
          ren1.AddActor((vtkProp)aHexActor);
          ren1.AddActor((vtkProp)aWedgeActor);
          ren1.AddActor((vtkProp)aPyramidActor);
          // places everyone!![]
          aTriActor.AddPosition((double)2,(double)0,(double)0);
          aQuadActor.AddPosition((double)4,(double)0,(double)0);
          aTetActor.AddPosition((double)6,(double)0,(double)0);
          aHexActor.AddPosition((double)8,(double)0,(double)0);
          aWedgeActor.AddPosition((double)10,(double)0,(double)0);
          aPyramidActor.AddPosition((double)12,(double)0,(double)0);
          BuildBackdrop(-1, 15, -1, 4, -1, 2, .1);
          ren1.AddActor((vtkProp)base1);
          base1.GetProperty().SetDiffuseColor((double).2,(double).2,(double).2);
          ren1.AddActor((vtkProp)left);
          left.GetProperty().SetDiffuseColor((double).2,(double).2,(double).2);
          ren1.AddActor((vtkProp)back);
          back.GetProperty().SetDiffuseColor((double).2,(double).2,(double).2);
          ren1.ResetCamera();
          ren1.GetActiveCamera().Dolly((double)2.5);
          ren1.ResetCameraClippingRange();
          renWin.Render();
          // create a little scorecard above each of the cells. These are displayed[]
          // if a ray cast hits the cell, otherwise they are not shown.[]
          pm = new vtkPlaneSource();
          pm.SetXResolution((int)1);
          pm.SetYResolution((int)1);
          pmapper = vtkPolyDataMapper.New();
          pmapper.SetInputConnection((vtkAlgorithmOutput)pm.GetOutputPort());
          // now try intersecting rays with the cell[]
          cellPicker = new vtkCellPicker();
          edgeCheck = new vtkActor();
          edgeCheck.SetMapper((vtkMapper)pmapper);
          edgeCheck.AddPosition((double)0.5,(double)2.5,(double)0);
          cellPicker.Pick((double)87,(double)71,(double)0,(vtkRenderer)ren1);
          if ((cellPicker.GetCellId()) != -1)
        {
          ren1.AddActor((vtkProp)edgeCheck);
        }

          triCheck = new vtkActor();
          triCheck.SetMapper((vtkMapper)pmapper);
          triCheck.AddPosition((double)2.5,(double)2.5,(double)0);
          cellPicker.Pick((double)139,(double)72,(double)0,(vtkRenderer)ren1);
          if ((cellPicker.GetCellId()) != -1)
        {
          ren1.AddActor((vtkProp)triCheck);
        }

          quadCheck = new vtkActor();
          quadCheck.SetMapper((vtkMapper)pmapper);
          quadCheck.AddPosition((double)4.5,(double)2.5,(double)0);
          cellPicker.Pick((double)192,(double)78,(double)0,(vtkRenderer)ren1);
          if ((cellPicker.GetCellId()) != -1)
        {
          ren1.AddActor((vtkProp)quadCheck);
        }

          tetCheck = new vtkActor();
          tetCheck.SetMapper((vtkMapper)pmapper);
          tetCheck.AddPosition((double)6.5,(double)2.5,(double)0);
          cellPicker.Pick((double)233,(double)70,(double)0,(vtkRenderer)ren1);
          if ((cellPicker.GetCellId()) != -1)
        {
          ren1.AddActor((vtkProp)tetCheck);
        }

          hexCheck = new vtkActor();
          hexCheck.SetMapper((vtkMapper)pmapper);
          hexCheck.AddPosition((double)8.5,(double)2.5,(double)0);
          cellPicker.Pick((double)287,(double)80,(double)0,(vtkRenderer)ren1);
          if ((cellPicker.GetCellId()) != -1)
        {
          ren1.AddActor((vtkProp)hexCheck);
        }

          wedgeCheck = new vtkActor();
          wedgeCheck.SetMapper((vtkMapper)pmapper);
          wedgeCheck.AddPosition((double)10.5,(double)2.5,(double)0);
          cellPicker.Pick((double)287,(double)80,(double)0,(vtkRenderer)ren1);
          if ((cellPicker.GetCellId()) != -1)
        {
          ren1.AddActor((vtkProp)wedgeCheck);
        }

          pyraCheck = new vtkActor();
          pyraCheck.SetMapper((vtkMapper)pmapper);
          pyraCheck.AddPosition((double)12.5,(double)2.5,(double)0);
          cellPicker.Pick((double)287,(double)80,(double)0,(vtkRenderer)ren1);
          if ((cellPicker.GetCellId()) != -1)
        {
          ren1.AddActor((vtkProp)pyraCheck);
        }

          // render the image[]
          //[]
          iren.Initialize();

        //deleteAllVTKObjects();
    }
Exemplo n.º 53
0
    /// <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();
    }
Exemplo n.º 54
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVTestCellDerivs(String [] argv)
    {
        //Prefix Content is: ""

          // Demonstrates vtkCellDerivatives for all cell types[]
          //[]
          // get the interactor ui[]
          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)0,(double)1,(double)0);
          tetraPoints.InsertPoint((int)3,(double)1,(double)1,(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);
          triangleTCoords = new vtkFloatArray();
          triangleTCoords.SetNumberOfComponents((int)2);
          triangleTCoords.SetNumberOfTuples((int)3);
          triangleTCoords.InsertTuple2((int)0,(double)1,(double)1);
          triangleTCoords.InsertTuple2((int)1,(double)2,(double)2);
          triangleTCoords.InsertTuple2((int)2,(double)3,(double)3);
          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);
          aTriangleGrid.GetPointData().SetTCoords((vtkDataArray)triangleTCoords);
          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);
          triangleStripTCoords = new vtkFloatArray();
          triangleStripTCoords.SetNumberOfComponents((int)2);
          triangleStripTCoords.SetNumberOfTuples((int)3);
          triangleStripTCoords.InsertTuple2((int)0,(double)1,(double)1);
          triangleStripTCoords.InsertTuple2((int)1,(double)2,(double)2);
          triangleStripTCoords.InsertTuple2((int)2,(double)3,(double)3);
          triangleStripTCoords.InsertTuple2((int)3,(double)4,(double)4);
          triangleStripTCoords.InsertTuple2((int)4,(double)5,(double)5);
          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);
          aTriangleStripGrid.GetPointData().SetTCoords((vtkDataArray)triangleStripTCoords);
          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();
          // Polyline[]
          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();
          // Polyvertex[]
          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)1,(double)1);
          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)1,(double)1,(double)0);
          ren1.AddActor((vtkProp)aHexaActor);
          aHexaActor.GetProperty().SetDiffuseColor((double)1,(double)1,(double)0);
          //[]
          // get the cell center of each type and put a glyph there[]
          //[]
          ball = new vtkSphereSource();
          ball.SetRadius((double).2);

            bool tryWorked = false;
          aVoxelScalars = new vtkFloatArray();
          N = aVoxelGrid.GetNumberOfPoints();
          aVoxelScalar = new vtkFloatArray();
          aVoxelScalar.SetNumberOfTuples((int)N);
          aVoxelScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aVoxelScalar.SetValue(i,0);
          i = i + 1;
        }

          aVoxelScalar.SetValue(0,4);
          aVoxelGrid.GetPointData().SetScalars(aVoxelScalar);

          aHexahedronScalars = new vtkFloatArray();
          N = aHexahedronGrid.GetNumberOfPoints();
          aHexahedronScalar = new vtkFloatArray();
          aHexahedronScalar.SetNumberOfTuples((int)N);
          aHexahedronScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aHexahedronScalar.SetValue(i,0);
          i = i + 1;
        }

          aHexahedronScalar.SetValue(0,4);
          aHexahedronGrid.GetPointData().SetScalars(aHexahedronScalar);

          aWedgeScalars = new vtkFloatArray();
          N = aWedgeGrid.GetNumberOfPoints();
          aWedgeScalar = new vtkFloatArray();
          aWedgeScalar.SetNumberOfTuples((int)N);
          aWedgeScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aWedgeScalar.SetValue(i,0);
          i = i + 1;
        }

          aWedgeScalar.SetValue(0,4);
          aWedgeGrid.GetPointData().SetScalars(aWedgeScalar);

          aPyramidScalars = new vtkFloatArray();
          N = aPyramidGrid.GetNumberOfPoints();
          aPyramidScalar = new vtkFloatArray();
          aPyramidScalar.SetNumberOfTuples((int)N);
          aPyramidScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aPyramidScalar.SetValue(i,0);
          i = i + 1;
        }

          aPyramidScalar.SetValue(0,4);
          aPyramidGrid.GetPointData().SetScalars(aPyramidScalar);

          aTetraScalars = new vtkFloatArray();
          N = aTetraGrid.GetNumberOfPoints();
          aTetraScalar = new vtkFloatArray();
          aTetraScalar.SetNumberOfTuples((int)N);
          aTetraScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aTetraScalar.SetValue(i,0);
          i = i + 1;
        }

          aTetraScalar.SetValue(0,4);
          aTetraGrid.GetPointData().SetScalars(aTetraScalar);

          aQuadScalars = new vtkFloatArray();
          N = aQuadGrid.GetNumberOfPoints();
          aQuadScalar = new vtkFloatArray();
          aQuadScalar.SetNumberOfTuples((int)N);
          aQuadScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aQuadScalar.SetValue(i,0);
          i = i + 1;
        }

          aQuadScalar.SetValue(0,4);
          aQuadGrid.GetPointData().SetScalars(aQuadScalar);

          aTriangleScalars = new vtkFloatArray();
          N = aTriangleGrid.GetNumberOfPoints();
          aTriangleScalar = new vtkFloatArray();
          aTriangleScalar.SetNumberOfTuples((int)N);
          aTriangleScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aTriangleScalar.SetValue(i,0);
          i = i + 1;
        }

          aTriangleScalar.SetValue(0,4);
          aTriangleGrid.GetPointData().SetScalars(aTriangleScalar);

          aTriangleStripScalars = new vtkFloatArray();
          N = aTriangleStripGrid.GetNumberOfPoints();
          aTriangleStripScalar = new vtkFloatArray();
          aTriangleStripScalar.SetNumberOfTuples((int)N);
          aTriangleStripScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aTriangleStripScalar.SetValue(i,0);
          i = i + 1;
        }

          aTriangleStripScalar.SetValue(0,4);
          aTriangleStripGrid.GetPointData().SetScalars(aTriangleStripScalar);

          aLineScalars = new vtkFloatArray();
          N = aLineGrid.GetNumberOfPoints();
          aLineScalar = new vtkFloatArray();
          aLineScalar.SetNumberOfTuples((int)N);
          aLineScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aLineScalar.SetValue(i,0);
          i = i + 1;
        }

          aLineScalar.SetValue(0,4);
          aLineGrid.GetPointData().SetScalars(aLineScalar);

          aPolyLineScalars = new vtkFloatArray();
          N = aPolyLineGrid.GetNumberOfPoints();
          aPolyLineScalar = new vtkFloatArray();
          aPolyLineScalar.SetNumberOfTuples((int)N);
          aPolyLineScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aPolyLineScalar.SetValue(i,0);
          i = i + 1;
        }

          aPolyLineScalar.SetValue(0,4);
          aPolyLineGrid.GetPointData().SetScalars(aPolyLineScalar);

          aVertexScalars = new vtkFloatArray();
          N = aVertexGrid.GetNumberOfPoints();
          aVertexScalar = new vtkFloatArray();
          aVertexScalar.SetNumberOfTuples((int)N);
          aVertexScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aVertexScalar.SetValue(i,0);
          i = i + 1;
        }

          aVertexScalar.SetValue(0,4);
          aVertexGrid.GetPointData().SetScalars(aVertexScalar);

          aPolyVertexScalars = new vtkFloatArray();
          N = aPolyVertexGrid.GetNumberOfPoints();
          aPolyVertexScalar = new vtkFloatArray();
          aPolyVertexScalar.SetNumberOfTuples((int)N);
          aPolyVertexScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aPolyVertexScalar.SetValue(i,0);
          i = i + 1;
        }

          aPolyVertexScalar.SetValue(0,4);
          aPolyVertexGrid.GetPointData().SetScalars(aPolyVertexScalar);

          aPixelScalars = new vtkFloatArray();
          N = aPixelGrid.GetNumberOfPoints();
          aPixelScalar = new vtkFloatArray();
          aPixelScalar.SetNumberOfTuples((int)N);
          aPixelScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aPixelScalar.SetValue(i,0);
          i = i + 1;
        }

          aPixelScalar.SetValue(0,4);
          aPixelGrid.GetPointData().SetScalars(aPixelScalar);

          aPolygonScalars = new vtkFloatArray();
          N = aPolygonGrid.GetNumberOfPoints();
          aPolygonScalar = new vtkFloatArray();
          aPolygonScalar.SetNumberOfTuples((int)N);
          aPolygonScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aPolygonScalar.SetValue(i,0);
          i = i + 1;
        }

          aPolygonScalar.SetValue(0,4);
          aPolygonGrid.GetPointData().SetScalars(aPolygonScalar);

          aPentaScalars = new vtkFloatArray();
          N = aPentaGrid.GetNumberOfPoints();
          aPentaScalar = new vtkFloatArray();
          aPentaScalar.SetNumberOfTuples((int)N);
          aPentaScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aPentaScalar.SetValue(i,0);
          i = i + 1;
        }

          aPentaScalar.SetValue(0,4);
          aPentaGrid.GetPointData().SetScalars(aPentaScalar);

          aHexaScalars = new vtkFloatArray();
          N = aHexaGrid.GetNumberOfPoints();
          aHexaScalar = new vtkFloatArray();
          aHexaScalar.SetNumberOfTuples((int)N);
          aHexaScalar.SetNumberOfComponents(1);
          i = 0;
          while((i) < N)
        {
          aHexaScalar.SetValue(i,0);
          i = i + 1;
        }

          aHexaScalar.SetValue(0,4);
          aHexaGrid.GetPointData().SetScalars(aHexaScalar);

          // write to the temp directory if possible, otherwise use .[]
          dir = ".";
          dir = TclToCsScriptTestDriver.GetTempDirectory();

        aVoxelderivs = new vtkCellDerivatives();
          aVoxelderivs.SetInput(aVoxelGrid);
          aVoxelderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aVoxel";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aVoxelWriter = new vtkUnstructuredGridWriter();
          aVoxelWriter.SetInputConnection(aVoxelderivs.GetOutputPort());
          aVoxelWriter.SetFileName(FileName);
          aVoxelWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aVoxelCenters = new vtkCellCenters();
          aVoxelCenters.SetInputConnection(aVoxelderivs.GetOutputPort());
          aVoxelCenters.VertexCellsOn();
          aVoxelhog = new vtkHedgeHog();
          aVoxelhog.SetInputConnection(aVoxelCenters.GetOutputPort());
          aVoxelmapHog = vtkPolyDataMapper.New();
          aVoxelmapHog.SetInputConnection(aVoxelhog.GetOutputPort());
          aVoxelmapHog.SetScalarModeToUseCellData();
          aVoxelmapHog.ScalarVisibilityOff();
          aVoxelhogActor = new vtkActor();
          aVoxelhogActor.SetMapper(aVoxelmapHog);
          aVoxelhogActor.GetProperty().SetColor(0,1,0);
          aVoxelGlyph3D = new vtkGlyph3D();
          aVoxelGlyph3D.SetInputConnection(aVoxelCenters.GetOutputPort());
          aVoxelGlyph3D.SetSource(ball.GetOutput());
          aVoxelCentersMapper = vtkPolyDataMapper.New();
          aVoxelCentersMapper.SetInputConnection(aVoxelGlyph3D.GetOutputPort());
          aVoxelCentersActor = new vtkActor();
        aVoxelCentersActor.SetMapper(aVoxelCentersMapper);
        aVoxelhogActor.SetPosition(aVoxelActor.GetPosition()[0],aVoxelActor.GetPosition()[1],aVoxelActor.GetPosition()[2]);
        ren1.AddActor((vtkProp)aVoxelhogActor);
        aVoxelhogActor.GetProperty().SetRepresentationToWireframe();

          aHexahedronderivs = new vtkCellDerivatives();
        aHexahedronderivs.SetInput(aHexahedronGrid);
        aHexahedronderivs.SetVectorModeToComputeGradient();
        FileName = dir;
        FileName += "/aHexahedron";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aHexahedronWriter = new vtkUnstructuredGridWriter();
          aHexahedronWriter.SetInputConnection(aHexahedronderivs.GetOutputPort());
          aHexahedronWriter.SetFileName(FileName);
          aHexahedronWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aHexahedronCenters = new vtkCellCenters();
          aHexahedronCenters.SetInputConnection(aHexahedronderivs.GetOutputPort());
          aHexahedronCenters.VertexCellsOn();
          aHexahedronhog = new vtkHedgeHog();
          aHexahedronhog.SetInputConnection(aHexahedronCenters.GetOutputPort());
          aHexahedronmapHog = vtkPolyDataMapper.New();
          aHexahedronmapHog.SetInputConnection(aHexahedronhog.GetOutputPort());
          aHexahedronmapHog.SetScalarModeToUseCellData();
          aHexahedronmapHog.ScalarVisibilityOff();
          aHexahedronhogActor = new vtkActor();
          aHexahedronhogActor.SetMapper(aHexahedronmapHog);
          aHexahedronhogActor.GetProperty().SetColor(0,1,0);
          aHexahedronGlyph3D = new vtkGlyph3D();
          aHexahedronGlyph3D.SetInputConnection(aHexahedronCenters.GetOutputPort());
          aHexahedronGlyph3D.SetSource(ball.GetOutput());
          aHexahedronCentersMapper = vtkPolyDataMapper.New();
          aHexahedronCentersMapper.SetInputConnection(aHexahedronGlyph3D.GetOutputPort());
          aHexahedronCentersActor = new vtkActor();
          aHexahedronCentersActor.SetMapper(aHexahedronCentersMapper);
          aHexahedronhogActor.SetPosition(aHexahedronActor.GetPosition()[0],aHexahedronActor.GetPosition()[1],aHexahedronActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aHexahedronhogActor);
          aHexahedronhogActor.GetProperty().SetRepresentationToWireframe();

        aWedgederivs = new vtkCellDerivatives();
          aWedgederivs.SetInput(aWedgeGrid);
          aWedgederivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aWedge";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aWedgeWriter = new vtkUnstructuredGridWriter();
          aWedgeWriter.SetInputConnection(aWedgederivs.GetOutputPort());
          aWedgeWriter.SetFileName(FileName);
          aWedgeWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aWedgeCenters = new vtkCellCenters();
          aWedgeCenters.SetInputConnection(aWedgederivs.GetOutputPort());
          aWedgeCenters.VertexCellsOn();
          aWedgehog = new vtkHedgeHog();
          aWedgehog.SetInputConnection(aWedgeCenters.GetOutputPort());
          aWedgemapHog = vtkPolyDataMapper.New();
          aWedgemapHog.SetInputConnection(aWedgehog.GetOutputPort());
          aWedgemapHog.SetScalarModeToUseCellData();
          aWedgemapHog.ScalarVisibilityOff();
          aWedgehogActor = new vtkActor();
          aWedgehogActor.SetMapper(aWedgemapHog);
          aWedgehogActor.GetProperty().SetColor(0,1,0);
          aWedgeGlyph3D = new vtkGlyph3D();
          aWedgeGlyph3D.SetInputConnection(aWedgeCenters.GetOutputPort());
          aWedgeGlyph3D.SetSource(ball.GetOutput());
          aWedgeCentersMapper = vtkPolyDataMapper.New();
          aWedgeCentersMapper.SetInputConnection(aWedgeGlyph3D.GetOutputPort());
          aWedgeCentersActor = new vtkActor();
          aWedgeCentersActor.SetMapper(aWedgeCentersMapper);
          aWedgehogActor.SetPosition(aWedgeActor.GetPosition()[0],aWedgeActor.GetPosition()[1],aWedgeActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aWedgehogActor);
          aWedgehogActor.GetProperty().SetRepresentationToWireframe();

        aPyramidderivs = new vtkCellDerivatives();
          aPyramidderivs.SetInput(aPyramidGrid);
          aPyramidderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aPyramid";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aPyramidWriter = new vtkUnstructuredGridWriter();
          aPyramidWriter.SetInputConnection(aPyramidderivs.GetOutputPort());
          aPyramidWriter.SetFileName(FileName);
          aPyramidWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aPyramidCenters = new vtkCellCenters();
          aPyramidCenters.SetInputConnection(aPyramidderivs.GetOutputPort());
          aPyramidCenters.VertexCellsOn();
          aPyramidhog = new vtkHedgeHog();
          aPyramidhog.SetInputConnection(aPyramidCenters.GetOutputPort());
          aPyramidmapHog = vtkPolyDataMapper.New();
          aPyramidmapHog.SetInputConnection(aPyramidhog.GetOutputPort());
          aPyramidmapHog.SetScalarModeToUseCellData();
          aPyramidmapHog.ScalarVisibilityOff();
          aPyramidhogActor = new vtkActor();
          aPyramidhogActor.SetMapper(aPyramidmapHog);
          aPyramidhogActor.GetProperty().SetColor(0,1,0);
          aPyramidGlyph3D = new vtkGlyph3D();
          aPyramidGlyph3D.SetInputConnection(aPyramidCenters.GetOutputPort());
          aPyramidGlyph3D.SetSource(ball.GetOutput());
          aPyramidCentersMapper = vtkPolyDataMapper.New();
          aPyramidCentersMapper.SetInputConnection(aPyramidGlyph3D.GetOutputPort());
          aPyramidCentersActor = new vtkActor();
          aPyramidCentersActor.SetMapper(aPyramidCentersMapper);
          aPyramidhogActor.SetPosition(aPyramidActor.GetPosition()[0],aPyramidActor.GetPosition()[1],aPyramidActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aPyramidhogActor);
          aPyramidhogActor.GetProperty().SetRepresentationToWireframe();

        aTetraderivs = new vtkCellDerivatives();
          aTetraderivs.SetInput(aTetraGrid);
          aTetraderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aTetra";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aTetraWriter = new vtkUnstructuredGridWriter();
          aTetraWriter.SetInputConnection(aTetraderivs.GetOutputPort());
          aTetraWriter.SetFileName(FileName);
          aTetraWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aTetraCenters = new vtkCellCenters();
          aTetraCenters.SetInputConnection(aTetraderivs.GetOutputPort());
          aTetraCenters.VertexCellsOn();
          aTetrahog = new vtkHedgeHog();
          aTetrahog.SetInputConnection(aTetraCenters.GetOutputPort());
          aTetramapHog = vtkPolyDataMapper.New();
          aTetramapHog.SetInputConnection(aTetrahog.GetOutputPort());
          aTetramapHog.SetScalarModeToUseCellData();
          aTetramapHog.ScalarVisibilityOff();
          aTetrahogActor = new vtkActor();
          aTetrahogActor.SetMapper(aTetramapHog);
          aTetrahogActor.GetProperty().SetColor(0,1,0);
          aTetraGlyph3D = new vtkGlyph3D();
          aTetraGlyph3D.SetInputConnection(aTetraCenters.GetOutputPort());
          aTetraGlyph3D.SetSource(ball.GetOutput());
          aTetraCentersMapper = vtkPolyDataMapper.New();
          aTetraCentersMapper.SetInputConnection(aTetraGlyph3D.GetOutputPort());
          aTetraCentersActor = new vtkActor();
          aTetraCentersActor.SetMapper(aTetraCentersMapper);
          aTetrahogActor.SetPosition(aTetraActor.GetPosition()[0],aTetraActor.GetPosition()[1],aTetraActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aTetrahogActor);
          aTetrahogActor.GetProperty().SetRepresentationToWireframe();

        aQuadderivs = new vtkCellDerivatives();
          aQuadderivs.SetInput(aQuadGrid);
          aQuadderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aQuad";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aQuadWriter = new vtkUnstructuredGridWriter();
          aQuadWriter.SetInputConnection(aQuadderivs.GetOutputPort());
          aQuadWriter.SetFileName(FileName);
          aQuadWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aQuadCenters = new vtkCellCenters();
          aQuadCenters.SetInputConnection(aQuadderivs.GetOutputPort());
          aQuadCenters.VertexCellsOn();
          aQuadhog = new vtkHedgeHog();
          aQuadhog.SetInputConnection(aQuadCenters.GetOutputPort());
          aQuadmapHog = vtkPolyDataMapper.New();
          aQuadmapHog.SetInputConnection(aQuadhog.GetOutputPort());
          aQuadmapHog.SetScalarModeToUseCellData();
          aQuadmapHog.ScalarVisibilityOff();
          aQuadhogActor = new vtkActor();
          aQuadhogActor.SetMapper(aQuadmapHog);
          aQuadhogActor.GetProperty().SetColor(0,1,0);
          aQuadGlyph3D = new vtkGlyph3D();
          aQuadGlyph3D.SetInputConnection(aQuadCenters.GetOutputPort());
          aQuadGlyph3D.SetSource(ball.GetOutput());
          aQuadCentersMapper = vtkPolyDataMapper.New();
          aQuadCentersMapper.SetInputConnection(aQuadGlyph3D.GetOutputPort());
          aQuadCentersActor = new vtkActor();
          aQuadCentersActor.SetMapper(aQuadCentersMapper);
          aQuadhogActor.SetPosition(aQuadActor.GetPosition()[0],aQuadActor.GetPosition()[1],aQuadActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aQuadhogActor);
          aQuadhogActor.GetProperty().SetRepresentationToWireframe();

        aTrianglederivs = new vtkCellDerivatives();
          aTrianglederivs.SetInput(aTriangleGrid);
          aTrianglederivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aTriangle";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aTriangleWriter = new vtkUnstructuredGridWriter();
          aTriangleWriter.SetInputConnection(aTrianglederivs.GetOutputPort());
          aTriangleWriter.SetFileName(FileName);
          aTriangleWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aTriangleCenters = new vtkCellCenters();
          aTriangleCenters.SetInputConnection(aTrianglederivs.GetOutputPort());
          aTriangleCenters.VertexCellsOn();
          aTrianglehog = new vtkHedgeHog();
          aTrianglehog.SetInputConnection(aTriangleCenters.GetOutputPort());
          aTrianglemapHog = vtkPolyDataMapper.New();
          aTrianglemapHog.SetInputConnection(aTrianglehog.GetOutputPort());
          aTrianglemapHog.SetScalarModeToUseCellData();
          aTrianglemapHog.ScalarVisibilityOff();
          aTrianglehogActor = new vtkActor();
          aTrianglehogActor.SetMapper(aTrianglemapHog);
          aTrianglehogActor.GetProperty().SetColor(0,1,0);
          aTriangleGlyph3D = new vtkGlyph3D();
          aTriangleGlyph3D.SetInputConnection(aTriangleCenters.GetOutputPort());
          aTriangleGlyph3D.SetSource(ball.GetOutput());
          aTriangleCentersMapper = vtkPolyDataMapper.New();
          aTriangleCentersMapper.SetInputConnection(aTriangleGlyph3D.GetOutputPort());
          aTriangleCentersActor = new vtkActor();
          aTriangleCentersActor.SetMapper(aTriangleCentersMapper);
          aTrianglehogActor.SetPosition(aTriangleActor.GetPosition()[0],aTriangleActor.GetPosition()[1],aTriangleActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aTrianglehogActor);
          aTrianglehogActor.GetProperty().SetRepresentationToWireframe();

        aTriangleStripderivs = new vtkCellDerivatives();
          aTriangleStripderivs.SetInput(aTriangleStripGrid);
          aTriangleStripderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aTriangleStrip";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aTriangleStripWriter = new vtkUnstructuredGridWriter();
          aTriangleStripWriter.SetInputConnection(aTriangleStripderivs.GetOutputPort());
          aTriangleStripWriter.SetFileName(FileName);
          aTriangleStripWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aTriangleStripCenters = new vtkCellCenters();
          aTriangleStripCenters.SetInputConnection(aTriangleStripderivs.GetOutputPort());
          aTriangleStripCenters.VertexCellsOn();
          aTriangleStriphog = new vtkHedgeHog();
          aTriangleStriphog.SetInputConnection(aTriangleStripCenters.GetOutputPort());
          aTriangleStripmapHog = vtkPolyDataMapper.New();
          aTriangleStripmapHog.SetInputConnection(aTriangleStriphog.GetOutputPort());
          aTriangleStripmapHog.SetScalarModeToUseCellData();
          aTriangleStripmapHog.ScalarVisibilityOff();
          aTriangleStriphogActor = new vtkActor();
          aTriangleStriphogActor.SetMapper(aTriangleStripmapHog);
          aTriangleStriphogActor.GetProperty().SetColor(0,1,0);
          aTriangleStripGlyph3D = new vtkGlyph3D();
          aTriangleStripGlyph3D.SetInputConnection(aTriangleStripCenters.GetOutputPort());
          aTriangleStripGlyph3D.SetSource(ball.GetOutput());
          aTriangleStripCentersMapper = vtkPolyDataMapper.New();
          aTriangleStripCentersMapper.SetInputConnection(aTriangleStripGlyph3D.GetOutputPort());
          aTriangleStripCentersActor = new vtkActor();
          aTriangleStripCentersActor.SetMapper(aTriangleStripCentersMapper);
          aTriangleStriphogActor.SetPosition(aTriangleStripActor.GetPosition()[0],aTriangleStripActor.GetPosition()[1],aTriangleStripActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aTriangleStriphogActor);
          aTriangleStriphogActor.GetProperty().SetRepresentationToWireframe();

        aLinederivs = new vtkCellDerivatives();
          aLinederivs.SetInput(aLineGrid);
          aLinederivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aLine";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aLineWriter = new vtkUnstructuredGridWriter();
          aLineWriter.SetInputConnection(aLinederivs.GetOutputPort());
          aLineWriter.SetFileName(FileName);
          aLineWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aLineCenters = new vtkCellCenters();
          aLineCenters.SetInputConnection(aLinederivs.GetOutputPort());
          aLineCenters.VertexCellsOn();
          aLinehog = new vtkHedgeHog();
          aLinehog.SetInputConnection(aLineCenters.GetOutputPort());
          aLinemapHog = vtkPolyDataMapper.New();
          aLinemapHog.SetInputConnection(aLinehog.GetOutputPort());
          aLinemapHog.SetScalarModeToUseCellData();
          aLinemapHog.ScalarVisibilityOff();
          aLinehogActor = new vtkActor();
          aLinehogActor.SetMapper(aLinemapHog);
          aLinehogActor.GetProperty().SetColor(0,1,0);
          aLineGlyph3D = new vtkGlyph3D();
          aLineGlyph3D.SetInputConnection(aLineCenters.GetOutputPort());
          aLineGlyph3D.SetSource(ball.GetOutput());
          aLineCentersMapper = vtkPolyDataMapper.New();
          aLineCentersMapper.SetInputConnection(aLineGlyph3D.GetOutputPort());
          aLineCentersActor = new vtkActor();
          aLineCentersActor.SetMapper(aLineCentersMapper);
          aLinehogActor.SetPosition(aLineActor.GetPosition()[0],aLineActor.GetPosition()[1],aLineActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aLinehogActor);
          aLinehogActor.GetProperty().SetRepresentationToWireframe();

        aPolyLinederivs = new vtkCellDerivatives();
          aPolyLinederivs.SetInput(aPolyLineGrid);
          aPolyLinederivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aPolyLine";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aPolyLineWriter = new vtkUnstructuredGridWriter();
          aPolyLineWriter.SetInputConnection(aPolyLinederivs.GetOutputPort());
          aPolyLineWriter.SetFileName(FileName);
          aPolyLineWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aPolyLineCenters = new vtkCellCenters();
          aPolyLineCenters.SetInputConnection(aPolyLinederivs.GetOutputPort());
          aPolyLineCenters.VertexCellsOn();
          aPolyLinehog = new vtkHedgeHog();
          aPolyLinehog.SetInputConnection(aPolyLineCenters.GetOutputPort());
          aPolyLinemapHog = vtkPolyDataMapper.New();
          aPolyLinemapHog.SetInputConnection(aPolyLinehog.GetOutputPort());
          aPolyLinemapHog.SetScalarModeToUseCellData();
          aPolyLinemapHog.ScalarVisibilityOff();
          aPolyLinehogActor = new vtkActor();
          aPolyLinehogActor.SetMapper(aPolyLinemapHog);
          aPolyLinehogActor.GetProperty().SetColor(0,1,0);
          aPolyLineGlyph3D = new vtkGlyph3D();
          aPolyLineGlyph3D.SetInputConnection(aPolyLineCenters.GetOutputPort());
          aPolyLineGlyph3D.SetSource(ball.GetOutput());
          aPolyLineCentersMapper = vtkPolyDataMapper.New();
          aPolyLineCentersMapper.SetInputConnection(aPolyLineGlyph3D.GetOutputPort());
          aPolyLineCentersActor = new vtkActor();
          aPolyLineCentersActor.SetMapper(aPolyLineCentersMapper);
          aPolyLinehogActor.SetPosition(aPolyLineActor.GetPosition()[0],aPolyLineActor.GetPosition()[1],aPolyLineActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aPolyLinehogActor);
          aPolyLinehogActor.GetProperty().SetRepresentationToWireframe();

        aVertexderivs = new vtkCellDerivatives();
          aVertexderivs.SetInput(aVertexGrid);
          aVertexderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aVertex";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aVertexWriter = new vtkUnstructuredGridWriter();
          aVertexWriter.SetInputConnection(aVertexderivs.GetOutputPort());
          aVertexWriter.SetFileName(FileName);
          aVertexWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aVertexCenters = new vtkCellCenters();
          aVertexCenters.SetInputConnection(aVertexderivs.GetOutputPort());
          aVertexCenters.VertexCellsOn();
          aVertexhog = new vtkHedgeHog();
          aVertexhog.SetInputConnection(aVertexCenters.GetOutputPort());
          aVertexmapHog = vtkPolyDataMapper.New();
          aVertexmapHog.SetInputConnection(aVertexhog.GetOutputPort());
          aVertexmapHog.SetScalarModeToUseCellData();
          aVertexmapHog.ScalarVisibilityOff();
          aVertexhogActor = new vtkActor();
          aVertexhogActor.SetMapper(aVertexmapHog);
          aVertexhogActor.GetProperty().SetColor(0,1,0);
          aVertexGlyph3D = new vtkGlyph3D();
          aVertexGlyph3D.SetInputConnection(aVertexCenters.GetOutputPort());
          aVertexGlyph3D.SetSource(ball.GetOutput());
          aVertexCentersMapper = vtkPolyDataMapper.New();
          aVertexCentersMapper.SetInputConnection(aVertexGlyph3D.GetOutputPort());
          aVertexCentersActor = new vtkActor();
          aVertexCentersActor.SetMapper(aVertexCentersMapper);
          aVertexhogActor.SetPosition(aVertexActor.GetPosition()[0],aVertexActor.GetPosition()[1],aVertexActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aVertexhogActor);
          aVertexhogActor.GetProperty().SetRepresentationToWireframe();

        aPolyVertexderivs = new vtkCellDerivatives();
          aPolyVertexderivs.SetInput(aPolyVertexGrid);
          aPolyVertexderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aPolyVertex";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aPolyVertexWriter = new vtkUnstructuredGridWriter();
          aPolyVertexWriter.SetInputConnection(aPolyVertexderivs.GetOutputPort());
          aPolyVertexWriter.SetFileName(FileName);
          aPolyVertexWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aPolyVertexCenters = new vtkCellCenters();
          aPolyVertexCenters.SetInputConnection(aPolyVertexderivs.GetOutputPort());
          aPolyVertexCenters.VertexCellsOn();
          aPolyVertexhog = new vtkHedgeHog();
          aPolyVertexhog.SetInputConnection(aPolyVertexCenters.GetOutputPort());
          aPolyVertexmapHog = vtkPolyDataMapper.New();
          aPolyVertexmapHog.SetInputConnection(aPolyVertexhog.GetOutputPort());
          aPolyVertexmapHog.SetScalarModeToUseCellData();
          aPolyVertexmapHog.ScalarVisibilityOff();
          aPolyVertexhogActor = new vtkActor();
          aPolyVertexhogActor.SetMapper(aPolyVertexmapHog);
          aPolyVertexhogActor.GetProperty().SetColor(0,1,0);
          aPolyVertexGlyph3D = new vtkGlyph3D();
          aPolyVertexGlyph3D.SetInputConnection(aPolyVertexCenters.GetOutputPort());
          aPolyVertexGlyph3D.SetSource(ball.GetOutput());
          aPolyVertexCentersMapper = vtkPolyDataMapper.New();
          aPolyVertexCentersMapper.SetInputConnection(aPolyVertexGlyph3D.GetOutputPort());
          aPolyVertexCentersActor = new vtkActor();
          aPolyVertexCentersActor.SetMapper(aPolyVertexCentersMapper);
          aPolyVertexhogActor.SetPosition(aPolyVertexActor.GetPosition()[0],aPolyVertexActor.GetPosition()[1],aPolyVertexActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aPolyVertexhogActor);
          aPolyVertexhogActor.GetProperty().SetRepresentationToWireframe();

        aPixelderivs = new vtkCellDerivatives();
          aPixelderivs.SetInput(aPixelGrid);
          aPixelderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aPixel";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aPixelWriter = new vtkUnstructuredGridWriter();
          aPixelWriter.SetInputConnection(aPixelderivs.GetOutputPort());
          aPixelWriter.SetFileName(FileName);
          aPixelWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aPixelCenters = new vtkCellCenters();
          aPixelCenters.SetInputConnection(aPixelderivs.GetOutputPort());
          aPixelCenters.VertexCellsOn();
          aPixelhog = new vtkHedgeHog();
          aPixelhog.SetInputConnection(aPixelCenters.GetOutputPort());
          aPixelmapHog = vtkPolyDataMapper.New();
          aPixelmapHog.SetInputConnection(aPixelhog.GetOutputPort());
          aPixelmapHog.SetScalarModeToUseCellData();
          aPixelmapHog.ScalarVisibilityOff();
          aPixelhogActor = new vtkActor();
          aPixelhogActor.SetMapper(aPixelmapHog);
          aPixelhogActor.GetProperty().SetColor(0,1,0);
          aPixelGlyph3D = new vtkGlyph3D();
          aPixelGlyph3D.SetInputConnection(aPixelCenters.GetOutputPort());
          aPixelGlyph3D.SetSource(ball.GetOutput());
          aPixelCentersMapper = vtkPolyDataMapper.New();
          aPixelCentersMapper.SetInputConnection(aPixelGlyph3D.GetOutputPort());
          aPixelCentersActor = new vtkActor();
          aPixelCentersActor.SetMapper(aPixelCentersMapper);
          aPixelhogActor.SetPosition(aPixelActor.GetPosition()[0],aPixelActor.GetPosition()[1],aPixelActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aPixelhogActor);
          aPixelhogActor.GetProperty().SetRepresentationToWireframe();

        aPolygonderivs = new vtkCellDerivatives();
          aPolygonderivs.SetInput(aPolygonGrid);
          aPolygonderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aPolygon";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aPolygonWriter = new vtkUnstructuredGridWriter();
          aPolygonWriter.SetInputConnection(aPolygonderivs.GetOutputPort());
          aPolygonWriter.SetFileName(FileName);
          aPolygonWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aPolygonCenters = new vtkCellCenters();
          aPolygonCenters.SetInputConnection(aPolygonderivs.GetOutputPort());
          aPolygonCenters.VertexCellsOn();
          aPolygonhog = new vtkHedgeHog();
          aPolygonhog.SetInputConnection(aPolygonCenters.GetOutputPort());
          aPolygonmapHog = vtkPolyDataMapper.New();
          aPolygonmapHog.SetInputConnection(aPolygonhog.GetOutputPort());
          aPolygonmapHog.SetScalarModeToUseCellData();
          aPolygonmapHog.ScalarVisibilityOff();
          aPolygonhogActor = new vtkActor();
          aPolygonhogActor.SetMapper(aPolygonmapHog);
          aPolygonhogActor.GetProperty().SetColor(0,1,0);
          aPolygonGlyph3D = new vtkGlyph3D();
          aPolygonGlyph3D.SetInputConnection(aPolygonCenters.GetOutputPort());
          aPolygonGlyph3D.SetSource(ball.GetOutput());
          aPolygonCentersMapper = vtkPolyDataMapper.New();
          aPolygonCentersMapper.SetInputConnection(aPolygonGlyph3D.GetOutputPort());
          aPolygonCentersActor = new vtkActor();
          aPolygonCentersActor.SetMapper(aPolygonCentersMapper);
          aPolygonhogActor.SetPosition(aPolygonActor.GetPosition()[0],aPolygonActor.GetPosition()[1],aPolygonActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aPolygonhogActor);
          aPolygonhogActor.GetProperty().SetRepresentationToWireframe();

        aPentaderivs = new vtkCellDerivatives();
          aPentaderivs.SetInput(aPentaGrid);
          aPentaderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aPenta";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aPentaWriter = new vtkUnstructuredGridWriter();
          aPentaWriter.SetInputConnection(aPentaderivs.GetOutputPort());
          aPentaWriter.SetFileName(FileName);
          aPentaWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aPentaCenters = new vtkCellCenters();
          aPentaCenters.SetInputConnection(aPentaderivs.GetOutputPort());
          aPentaCenters.VertexCellsOn();
          aPentahog = new vtkHedgeHog();
          aPentahog.SetInputConnection(aPentaCenters.GetOutputPort());
          aPentamapHog = vtkPolyDataMapper.New();
          aPentamapHog.SetInputConnection(aPentahog.GetOutputPort());
          aPentamapHog.SetScalarModeToUseCellData();
          aPentamapHog.ScalarVisibilityOff();
          aPentahogActor = new vtkActor();
          aPentahogActor.SetMapper(aPentamapHog);
          aPentahogActor.GetProperty().SetColor(0,1,0);
          aPentaGlyph3D = new vtkGlyph3D();
          aPentaGlyph3D.SetInputConnection(aPentaCenters.GetOutputPort());
          aPentaGlyph3D.SetSource(ball.GetOutput());
          aPentaCentersMapper = vtkPolyDataMapper.New();
          aPentaCentersMapper.SetInputConnection(aPentaGlyph3D.GetOutputPort());
          aPentaCentersActor = new vtkActor();
          aPentaCentersActor.SetMapper(aPentaCentersMapper);
          aPentahogActor.SetPosition(aPentaActor.GetPosition()[0],aPentaActor.GetPosition()[1],aPentaActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aPentahogActor);
          aPentahogActor.GetProperty().SetRepresentationToWireframe();

        aHexaderivs = new vtkCellDerivatives();
          aHexaderivs.SetInput(aHexaGrid);
          aHexaderivs.SetVectorModeToComputeGradient();
          FileName = dir;
          FileName += "/aHexa";
          FileName += ".vtk";
          // make sure the directory is writeable first[]
          tryWorked = false;
          try
          {
         channel = new StreamWriter("" + (dir.ToString()) + "/test.tmp");
         tryWorked = true;
          }
          catch(Exception)
        {
        tryWorked = false;
        }
          if(tryWorked)
        {
          channel.Close();
          File.Delete("" + (dir.ToString()) + "/test.tmp");
          aHexaWriter = new vtkUnstructuredGridWriter();
          aHexaWriter.SetInputConnection(aHexaderivs.GetOutputPort());
          aHexaWriter.SetFileName(FileName);
          aHexaWriter.Write();
          // delete the file[]
          File.Delete("FileName");
        }

          aHexaCenters = new vtkCellCenters();
          aHexaCenters.SetInputConnection(aHexaderivs.GetOutputPort());
          aHexaCenters.VertexCellsOn();
          aHexahog = new vtkHedgeHog();
          aHexahog.SetInputConnection(aHexaCenters.GetOutputPort());
          aHexamapHog = vtkPolyDataMapper.New();
          aHexamapHog.SetInputConnection(aHexahog.GetOutputPort());
          aHexamapHog.SetScalarModeToUseCellData();
          aHexamapHog.ScalarVisibilityOff();
          aHexahogActor = new vtkActor();
          aHexahogActor.SetMapper(aHexamapHog);
          aHexahogActor.GetProperty().SetColor(0,1,0);
          aHexaGlyph3D = new vtkGlyph3D();
          aHexaGlyph3D.SetInputConnection(aHexaCenters.GetOutputPort());
          aHexaGlyph3D.SetSource(ball.GetOutput());
          aHexaCentersMapper = vtkPolyDataMapper.New();
          aHexaCentersMapper.SetInputConnection(aHexaGlyph3D.GetOutputPort());
          aHexaCentersActor = new vtkActor();
          aHexaCentersActor.SetMapper(aHexaCentersMapper);
          aHexahogActor.SetPosition(aHexaActor.GetPosition()[0],aHexaActor.GetPosition()[1],aHexaActor.GetPosition()[2]);
          ren1.AddActor((vtkProp)aHexahogActor);
          aHexahogActor.GetProperty().SetRepresentationToWireframe();

          ren1.ResetCamera();
          ren1.GetActiveCamera().Azimuth((double)30);
          ren1.GetActiveCamera().Elevation((double)20);
          ren1.GetActiveCamera().Dolly((double)3.0);
          ren1.ResetCameraClippingRange();
          renWin.SetSize((int)300,(int)150);
          renWin.Render();
          // render the image[]
          //[]
          iren.Initialize();

        //deleteAllVTKObjects();
    }
Exemplo n.º 55
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVofficeStreamPoints(String [] argv)
    {
        //Prefix Content is: ""

          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // read data[]
          //[]
          reader = new vtkStructuredGridReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/office.binary.vtk");
          reader.Update();
          //force a read to occur[]
          // to add coverage for vtkOnePieceExtentTranslator[]
          translator = new vtkOnePieceExtentTranslator();
          vtkStreamingDemandDrivenPipeline.SetExtentTranslator(reader.GetOutputInformation(0), (vtkExtentTranslator)translator);
          length = reader.GetOutput().GetLength();
          maxVelocity = reader.GetOutput().GetPointData().GetVectors().GetMaxNorm();
          maxTime = 35.0*length/maxVelocity;
          table1 = new vtkStructuredGridGeometryFilter();
          table1.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          table1.SetExtent((int)11,(int)15,(int)7,(int)9,(int)8,(int)8);
          mapTable1 = vtkPolyDataMapper.New();
          mapTable1.SetInputConnection((vtkAlgorithmOutput)table1.GetOutputPort());
          mapTable1.ScalarVisibilityOff();
          table1Actor = new vtkActor();
          table1Actor.SetMapper((vtkMapper)mapTable1);
          table1Actor.GetProperty().SetColor((double).59,(double).427,(double).392);
          table2 = new vtkStructuredGridGeometryFilter();
          table2.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          table2.SetExtent((int)11,(int)15,(int)10,(int)12,(int)8,(int)8);
          mapTable2 = vtkPolyDataMapper.New();
          mapTable2.SetInputConnection((vtkAlgorithmOutput)table2.GetOutputPort());
          mapTable2.ScalarVisibilityOff();
          table2Actor = new vtkActor();
          table2Actor.SetMapper((vtkMapper)mapTable2);
          table2Actor.GetProperty().SetColor((double).59,(double).427,(double).392);
          FilingCabinet1 = new vtkStructuredGridGeometryFilter();
          FilingCabinet1.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          FilingCabinet1.SetExtent((int)15,(int)15,(int)7,(int)9,(int)0,(int)8);
          mapFilingCabinet1 = vtkPolyDataMapper.New();
          mapFilingCabinet1.SetInputConnection((vtkAlgorithmOutput)FilingCabinet1.GetOutputPort());
          mapFilingCabinet1.ScalarVisibilityOff();
          FilingCabinet1Actor = new vtkActor();
          FilingCabinet1Actor.SetMapper((vtkMapper)mapFilingCabinet1);
          FilingCabinet1Actor.GetProperty().SetColor((double).8,(double).8,(double).6);
          FilingCabinet2 = new vtkStructuredGridGeometryFilter();
          FilingCabinet2.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          FilingCabinet2.SetExtent((int)15,(int)15,(int)10,(int)12,(int)0,(int)8);
          mapFilingCabinet2 = vtkPolyDataMapper.New();
          mapFilingCabinet2.SetInputConnection((vtkAlgorithmOutput)FilingCabinet2.GetOutputPort());
          mapFilingCabinet2.ScalarVisibilityOff();
          FilingCabinet2Actor = new vtkActor();
          FilingCabinet2Actor.SetMapper((vtkMapper)mapFilingCabinet2);
          FilingCabinet2Actor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf1Top = new vtkStructuredGridGeometryFilter();
          bookshelf1Top.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf1Top.SetExtent((int)13,(int)13,(int)0,(int)4,(int)0,(int)11);
          mapBookshelf1Top = vtkPolyDataMapper.New();
          mapBookshelf1Top.SetInputConnection((vtkAlgorithmOutput)bookshelf1Top.GetOutputPort());
          mapBookshelf1Top.ScalarVisibilityOff();
          bookshelf1TopActor = new vtkActor();
          bookshelf1TopActor.SetMapper((vtkMapper)mapBookshelf1Top);
          bookshelf1TopActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf1Bottom = new vtkStructuredGridGeometryFilter();
          bookshelf1Bottom.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf1Bottom.SetExtent((int)20,(int)20,(int)0,(int)4,(int)0,(int)11);
          mapBookshelf1Bottom = vtkPolyDataMapper.New();
          mapBookshelf1Bottom.SetInputConnection((vtkAlgorithmOutput)bookshelf1Bottom.GetOutputPort());
          mapBookshelf1Bottom.ScalarVisibilityOff();
          bookshelf1BottomActor = new vtkActor();
          bookshelf1BottomActor.SetMapper((vtkMapper)mapBookshelf1Bottom);
          bookshelf1BottomActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf1Front = new vtkStructuredGridGeometryFilter();
          bookshelf1Front.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf1Front.SetExtent((int)13,(int)20,(int)0,(int)0,(int)0,(int)11);
          mapBookshelf1Front = vtkPolyDataMapper.New();
          mapBookshelf1Front.SetInputConnection((vtkAlgorithmOutput)bookshelf1Front.GetOutputPort());
          mapBookshelf1Front.ScalarVisibilityOff();
          bookshelf1FrontActor = new vtkActor();
          bookshelf1FrontActor.SetMapper((vtkMapper)mapBookshelf1Front);
          bookshelf1FrontActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf1Back = new vtkStructuredGridGeometryFilter();
          bookshelf1Back.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf1Back.SetExtent((int)13,(int)20,(int)4,(int)4,(int)0,(int)11);
          mapBookshelf1Back = vtkPolyDataMapper.New();
          mapBookshelf1Back.SetInputConnection((vtkAlgorithmOutput)bookshelf1Back.GetOutputPort());
          mapBookshelf1Back.ScalarVisibilityOff();
          bookshelf1BackActor = new vtkActor();
          bookshelf1BackActor.SetMapper((vtkMapper)mapBookshelf1Back);
          bookshelf1BackActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf1LHS = new vtkStructuredGridGeometryFilter();
          bookshelf1LHS.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf1LHS.SetExtent((int)13,(int)20,(int)0,(int)4,(int)0,(int)0);
          mapBookshelf1LHS = vtkPolyDataMapper.New();
          mapBookshelf1LHS.SetInputConnection((vtkAlgorithmOutput)bookshelf1LHS.GetOutputPort());
          mapBookshelf1LHS.ScalarVisibilityOff();
          bookshelf1LHSActor = new vtkActor();
          bookshelf1LHSActor.SetMapper((vtkMapper)mapBookshelf1LHS);
          bookshelf1LHSActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf1RHS = new vtkStructuredGridGeometryFilter();
          bookshelf1RHS.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf1RHS.SetExtent((int)13,(int)20,(int)0,(int)4,(int)11,(int)11);
          mapBookshelf1RHS = vtkPolyDataMapper.New();
          mapBookshelf1RHS.SetInputConnection((vtkAlgorithmOutput)bookshelf1RHS.GetOutputPort());
          mapBookshelf1RHS.ScalarVisibilityOff();
          bookshelf1RHSActor = new vtkActor();
          bookshelf1RHSActor.SetMapper((vtkMapper)mapBookshelf1RHS);
          bookshelf1RHSActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf2Top = new vtkStructuredGridGeometryFilter();
          bookshelf2Top.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf2Top.SetExtent((int)13,(int)13,(int)15,(int)19,(int)0,(int)11);
          mapBookshelf2Top = vtkPolyDataMapper.New();
          mapBookshelf2Top.SetInputConnection((vtkAlgorithmOutput)bookshelf2Top.GetOutputPort());
          mapBookshelf2Top.ScalarVisibilityOff();
          bookshelf2TopActor = new vtkActor();
          bookshelf2TopActor.SetMapper((vtkMapper)mapBookshelf2Top);
          bookshelf2TopActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf2Bottom = new vtkStructuredGridGeometryFilter();
          bookshelf2Bottom.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf2Bottom.SetExtent((int)20,(int)20,(int)15,(int)19,(int)0,(int)11);
          mapBookshelf2Bottom = vtkPolyDataMapper.New();
          mapBookshelf2Bottom.SetInputConnection((vtkAlgorithmOutput)bookshelf2Bottom.GetOutputPort());
          mapBookshelf2Bottom.ScalarVisibilityOff();
          bookshelf2BottomActor = new vtkActor();
          bookshelf2BottomActor.SetMapper((vtkMapper)mapBookshelf2Bottom);
          bookshelf2BottomActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf2Front = new vtkStructuredGridGeometryFilter();
          bookshelf2Front.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf2Front.SetExtent((int)13,(int)20,(int)15,(int)15,(int)0,(int)11);
          mapBookshelf2Front = vtkPolyDataMapper.New();
          mapBookshelf2Front.SetInputConnection((vtkAlgorithmOutput)bookshelf2Front.GetOutputPort());
          mapBookshelf2Front.ScalarVisibilityOff();
          bookshelf2FrontActor = new vtkActor();
          bookshelf2FrontActor.SetMapper((vtkMapper)mapBookshelf2Front);
          bookshelf2FrontActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf2Back = new vtkStructuredGridGeometryFilter();
          bookshelf2Back.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf2Back.SetExtent((int)13,(int)20,(int)19,(int)19,(int)0,(int)11);
          mapBookshelf2Back = vtkPolyDataMapper.New();
          mapBookshelf2Back.SetInputConnection((vtkAlgorithmOutput)bookshelf2Back.GetOutputPort());
          mapBookshelf2Back.ScalarVisibilityOff();
          bookshelf2BackActor = new vtkActor();
          bookshelf2BackActor.SetMapper((vtkMapper)mapBookshelf2Back);
          bookshelf2BackActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf2LHS = new vtkStructuredGridGeometryFilter();
          bookshelf2LHS.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf2LHS.SetExtent((int)13,(int)20,(int)15,(int)19,(int)0,(int)0);
          mapBookshelf2LHS = vtkPolyDataMapper.New();
          mapBookshelf2LHS.SetInputConnection((vtkAlgorithmOutput)bookshelf2LHS.GetOutputPort());
          mapBookshelf2LHS.ScalarVisibilityOff();
          bookshelf2LHSActor = new vtkActor();
          bookshelf2LHSActor.SetMapper((vtkMapper)mapBookshelf2LHS);
          bookshelf2LHSActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          bookshelf2RHS = new vtkStructuredGridGeometryFilter();
          bookshelf2RHS.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          bookshelf2RHS.SetExtent((int)13,(int)20,(int)15,(int)19,(int)11,(int)11);
          mapBookshelf2RHS = vtkPolyDataMapper.New();
          mapBookshelf2RHS.SetInputConnection((vtkAlgorithmOutput)bookshelf2RHS.GetOutputPort());
          mapBookshelf2RHS.ScalarVisibilityOff();
          bookshelf2RHSActor = new vtkActor();
          bookshelf2RHSActor.SetMapper((vtkMapper)mapBookshelf2RHS);
          bookshelf2RHSActor.GetProperty().SetColor((double).8,(double).8,(double).6);
          window = new vtkStructuredGridGeometryFilter();
          window.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          window.SetExtent((int)20,(int)20,(int)6,(int)13,(int)10,(int)13);
          mapWindow = vtkPolyDataMapper.New();
          mapWindow.SetInputConnection((vtkAlgorithmOutput)window.GetOutputPort());
          mapWindow.ScalarVisibilityOff();
          windowActor = new vtkActor();
          windowActor.SetMapper((vtkMapper)mapWindow);
          windowActor.GetProperty().SetColor((double).3,(double).3,(double).5);
          outlet = new vtkStructuredGridGeometryFilter();
          outlet.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          outlet.SetExtent((int)0,(int)0,(int)9,(int)10,(int)14,(int)16);
          mapOutlet = vtkPolyDataMapper.New();
          mapOutlet.SetInputConnection((vtkAlgorithmOutput)outlet.GetOutputPort());
          mapOutlet.ScalarVisibilityOff();
          outletActor = new vtkActor();
          outletActor.SetMapper((vtkMapper)mapOutlet);
          outletActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          inlet = new vtkStructuredGridGeometryFilter();
          inlet.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          inlet.SetExtent((int)0,(int)0,(int)9,(int)10,(int)0,(int)6);
          mapInlet = vtkPolyDataMapper.New();
          mapInlet.SetInputConnection((vtkAlgorithmOutput)inlet.GetOutputPort());
          mapInlet.ScalarVisibilityOff();
          inletActor = new vtkActor();
          inletActor.SetMapper((vtkMapper)mapInlet);
          inletActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          outline = new vtkStructuredGridOutlineFilter();
          outline.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          mapOutline = vtkPolyDataMapper.New();
          mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)mapOutline);
          outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          // Create source for streamtubes[]
          streamer = new vtkStreamPoints();
          streamer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          streamer.SetStartPosition((double)0.1,(double)2.1,(double)0.5);
          streamer.SetMaximumPropagationTime((double)500);
          streamer.SetTimeIncrement((double)0.5);
          streamer.SetIntegrationDirectionToForward();
          cone = new vtkConeSource();
          cone.SetResolution((int)8);
          cones = new vtkGlyph3D();
          cones.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          cones.SetSourceConnection(cone.GetOutputPort());
          cones.SetScaleFactor((double)0.5);
          cones.SetScaleModeToScaleByVector();
          mapCones = vtkPolyDataMapper.New();
          mapCones.SetInputConnection((vtkAlgorithmOutput)cones.GetOutputPort());
          mapCones.SetScalarRange((double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[1]);
          conesActor = new vtkActor();
          conesActor.SetMapper((vtkMapper)mapCones);
          ren1.AddActor((vtkProp)table1Actor);
          ren1.AddActor((vtkProp)table2Actor);
          ren1.AddActor((vtkProp)FilingCabinet1Actor);
          ren1.AddActor((vtkProp)FilingCabinet2Actor);
          ren1.AddActor((vtkProp)bookshelf1TopActor);
          ren1.AddActor((vtkProp)bookshelf1BottomActor);
          ren1.AddActor((vtkProp)bookshelf1FrontActor);
          ren1.AddActor((vtkProp)bookshelf1BackActor);
          ren1.AddActor((vtkProp)bookshelf1LHSActor);
          ren1.AddActor((vtkProp)bookshelf1RHSActor);
          ren1.AddActor((vtkProp)bookshelf2TopActor);
          ren1.AddActor((vtkProp)bookshelf2BottomActor);
          ren1.AddActor((vtkProp)bookshelf2FrontActor);
          ren1.AddActor((vtkProp)bookshelf2BackActor);
          ren1.AddActor((vtkProp)bookshelf2LHSActor);
          ren1.AddActor((vtkProp)bookshelf2RHSActor);
          ren1.AddActor((vtkProp)windowActor);
          ren1.AddActor((vtkProp)outletActor);
          ren1.AddActor((vtkProp)inletActor);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)conesActor);
          ren1.SetBackground((double)0.4,(double)0.4,(double)0.5);
          aCamera = new vtkCamera();
          aCamera.SetClippingRange((double)0.7724,(double)39);
          aCamera.SetFocalPoint((double)1.14798,(double)3.08416,(double)2.47187);
          aCamera.SetPosition((double)-2.64683,(double)-3.55525,(double)3.55848);
          aCamera.SetViewUp((double)0.0511273,(double)0.132773,(double)0.989827);
          aCamera.SetViewAngle((double)15.5033);
          ren1.SetActiveCamera((vtkCamera)aCamera);
          renWin.SetSize((int)500,(int)300);
          iren.Initialize();
          // interact with data[]

        //deleteAllVTKObjects();
    }
Exemplo n.º 56
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVstreamTracer(String [] argv)
    {
        //Prefix Content is: ""

          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();

          // this test has some wireframe geometry
          // Make sure multisampling is disabled to avoid generating multiple
          // regression images
          // renWin SetMultiSamples 0

          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // read data[]
          //[]
          reader = new vtkStructuredGridReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/office.binary.vtk");
          reader.Update();
          //force a read to occur[]
          outline = new vtkStructuredGridOutlineFilter();
          outline.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          mapOutline = vtkPolyDataMapper.New();
          mapOutline.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)mapOutline);
          outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          rk = new vtkRungeKutta45();
          // Create source for streamtubes[]
          streamer = new vtkStreamTracer();
          streamer.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          streamer.SetStartPosition((double)0.1,(double)2.1,(double)0.5);
          streamer.SetMaximumPropagation((double)500);
          streamer.SetIntegrationStepUnit(2);
          streamer.SetMinimumIntegrationStep((double)0.1);
          streamer.SetMaximumIntegrationStep((double)1.0);
          streamer.SetInitialIntegrationStep((double)0.2);
          streamer.SetIntegrationDirection((int)0);
          streamer.SetIntegrator((vtkInitialValueProblemSolver)rk);
          streamer.SetRotationScale((double)0.5);
          streamer.SetMaximumError((double)1.0e-8);
          aa = new vtkAssignAttribute();
          aa.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort());
          aa.Assign((string)"Normals",(string)"NORMALS",(string)"POINT_DATA");
          rf1 = new vtkRibbonFilter();
          rf1.SetInputConnection((vtkAlgorithmOutput)aa.GetOutputPort());
          rf1.SetWidth((double)0.1);
          rf1.VaryWidthOff();
          mapStream = vtkPolyDataMapper.New();
          mapStream.SetInputConnection((vtkAlgorithmOutput)rf1.GetOutputPort());
          mapStream.SetScalarRange((double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[0],(double)((vtkDataSet)reader.GetOutput()).GetScalarRange()[1]);
          streamActor = new vtkActor();
          streamActor.SetMapper((vtkMapper)mapStream);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)streamActor);
          ren1.SetBackground((double)0.4,(double)0.4,(double)0.5);
          cam = ren1.GetActiveCamera();
          cam.SetPosition((double)-2.35599,(double)-3.35001,(double)4.59236);
          cam.SetFocalPoint((double)2.255,(double)2.255,(double)1.28413);
          cam.SetViewUp((double)0.311311,(double)0.279912,(double)0.908149);
          cam.SetClippingRange((double)1.12294,(double)16.6226);
          renWin.SetSize((int)300,(int)200);
          iren.Initialize();
          // interact with data[]

        //deleteAllVTKObjects();
    }
Exemplo n.º 57
0
    /// <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 vtkMultiBlockPLOT3DReader();
          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.SetInputData(pl3d.GetOutput().GetBlock(0));
          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.SetInputData(pl3d.GetOutput().GetBlock(0));
          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.SetInputData(pl3d.GetOutput().GetBlock(0));
          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().GetBlock(0)).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
          plane1Actor = new vtkActor();
          plane1Actor.SetMapper((vtkMapper)plane1Map);
          plane1Actor.SetTexture((vtkTexture)texture);
          plane1Actor.GetProperty().SetOpacity((double)0.999);
          plane2 = new vtkStructuredGridGeometryFilter();
          plane2.SetInputData(pl3d.GetOutput().GetBlock(0));
          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().GetBlock(0)).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
          plane2Actor = new vtkActor();
          plane2Actor.SetMapper((vtkMapper)plane2Map);
          plane2Actor.SetTexture((vtkTexture)texture);
          plane2Actor.GetProperty().SetOpacity((double)0.999);
          plane3 = new vtkStructuredGridGeometryFilter();
          plane3.SetInputData(pl3d.GetOutput().GetBlock(0));
          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().GetBlock(0)).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
          plane3Actor = new vtkActor();
          plane3Actor.SetMapper((vtkMapper)plane3Map);
          plane3Actor.SetTexture((vtkTexture)texture);
          plane3Actor.GetProperty().SetOpacity((double)0.999);
          // outline[]
          outline = new vtkStructuredGridOutlineFilter();
          outline.SetInputData(pl3d.GetOutput().GetBlock(0));
          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();
    }
Exemplo n.º 58
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVgaussian(String [] argv)
    {
        //Prefix Content is: ""

          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          renWin.SetSize((int)300,(int)300);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          camera = new vtkCamera();
          camera.ParallelProjectionOn();
          camera.SetViewUp((double)0,(double)1,(double)0);
          camera.SetFocalPoint((double)12,(double)10.5,(double)15);
          camera.SetPosition((double)-70,(double)15,(double)34);
          camera.ComputeViewPlaneNormal();
          ren1.SetActiveCamera((vtkCamera)camera);
          // Create the reader for the data[]
          //vtkStructuredPointsReader reader[]
          reader = new vtkGaussianCubeReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/m4_TotalDensity.cube");
          reader.SetHBScale((double)1.1);
          reader.SetBScale((double)10);
          reader.Update();
          range = reader.GetGridOutput().GetPointData().GetScalars().GetRange();
          min = (double)(lindex(range,0));
          max = (double)(lindex(range,1));
          readerSS = new vtkImageShiftScale();
          readerSS.SetInput((vtkDataObject)reader.GetGridOutput());
          readerSS.SetShift((double)min*-1);
          readerSS.SetScale((double)255/(max-min));
          readerSS.SetOutputScalarTypeToUnsignedChar();
          bounds = new vtkOutlineFilter();
          bounds.SetInput((vtkDataObject)reader.GetGridOutput());
          boundsMapper = vtkPolyDataMapper.New();
          boundsMapper.SetInputConnection((vtkAlgorithmOutput)bounds.GetOutputPort());
          boundsActor = new vtkActor();
          boundsActor.SetMapper((vtkMapper)boundsMapper);
          boundsActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          contour = new vtkContourFilter();
          contour.SetInput((vtkDataObject)reader.GetGridOutput());
          contour.GenerateValues((int)5,(double)0,(double).05);
          contourMapper = vtkPolyDataMapper.New();
          contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort());
          contourMapper.SetScalarRange((double)0,(double).1);
          ((vtkLookupTable)contourMapper.GetLookupTable()).SetHueRange(0.32,0);
          contourActor = new vtkActor();
          contourActor.SetMapper((vtkMapper)contourMapper);
          contourActor.GetProperty().SetOpacity((double).5);
          // Create transfer mapping scalar value to opacity[]
          opacityTransferFunction = new vtkPiecewiseFunction();
          opacityTransferFunction.AddPoint((double)0,(double)0.01);
          opacityTransferFunction.AddPoint((double)255,(double)0.35);
          opacityTransferFunction.ClampingOn();
          // Create transfer mapping scalar value to color[]
          colorTransferFunction = new vtkColorTransferFunction();
          colorTransferFunction.AddHSVPoint((double)0.0,(double)0.66,(double)1.0,(double)1.0);
          colorTransferFunction.AddHSVPoint((double)50.0,(double)0.33,(double)1.0,(double)1.0);
          colorTransferFunction.AddHSVPoint((double)100.0,(double)0.00,(double)1.0,(double)1.0);
          // The property describes how the data will look[]
          volumeProperty = new vtkVolumeProperty();
          volumeProperty.SetColor((vtkColorTransferFunction)colorTransferFunction);
          volumeProperty.SetScalarOpacity((vtkPiecewiseFunction)opacityTransferFunction);
          volumeProperty.SetInterpolationTypeToLinear();
          // The mapper / ray cast function know how to render the data[]
          compositeFunction = new vtkVolumeRayCastCompositeFunction();
          volumeMapper = new vtkVolumeRayCastMapper();
          //vtkVolumeTextureMapper2D volumeMapper[]
          volumeMapper.SetVolumeRayCastFunction((vtkVolumeRayCastFunction)compositeFunction);
          volumeMapper.SetInputConnection((vtkAlgorithmOutput)readerSS.GetOutputPort());
          // The volume holds the mapper and the property and[]
          // can be used to position/orient the volume[]
          volume = new vtkVolume();
          volume.SetMapper((vtkAbstractVolumeMapper)volumeMapper);
          volume.SetProperty((vtkVolumeProperty)volumeProperty);
          ren1.AddVolume((vtkProp)volume);
          //ren1 AddActor contourActor[]
          ren1.AddActor((vtkProp)boundsActor);
          //#####################################################################[]
          Sphere = new vtkSphereSource();
          Sphere.SetCenter((double)0,(double)0,(double)0);
          Sphere.SetRadius((double)1);
          Sphere.SetThetaResolution((int)16);
          Sphere.SetStartTheta((double)0);
          Sphere.SetEndTheta((double)360);
          Sphere.SetPhiResolution((int)16);
          Sphere.SetStartPhi((double)0);
          Sphere.SetEndPhi((double)180);
          Glyph = new vtkGlyph3D();
          Glyph.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          Glyph.SetOrient((int)1);
          Glyph.SetColorMode((int)1);
          //Glyph ScalingOn[]
          Glyph.SetScaleMode((int)2);
          Glyph.SetScaleFactor((double).6);
          Glyph.SetSource((vtkPolyData)Sphere.GetOutput());
          AtomsMapper = vtkPolyDataMapper.New();
          AtomsMapper.SetInputConnection((vtkAlgorithmOutput)Glyph.GetOutputPort());
          AtomsMapper.SetImmediateModeRendering((int)1);
          AtomsMapper.UseLookupTableScalarRangeOff();
          AtomsMapper.SetScalarVisibility((int)1);
          AtomsMapper.SetScalarModeToDefault();
          Atoms = new vtkActor();
          Atoms.SetMapper((vtkMapper)AtomsMapper);
          Atoms.GetProperty().SetRepresentationToSurface();
          Atoms.GetProperty().SetInterpolationToGouraud();
          Atoms.GetProperty().SetAmbient((double)0.15);
          Atoms.GetProperty().SetDiffuse((double)0.85);
          Atoms.GetProperty().SetSpecular((double)0.1);
          Atoms.GetProperty().SetSpecularPower((double)100);
          Atoms.GetProperty().SetSpecularColor((double)1,(double)1,(double)1);
          Atoms.GetProperty().SetColor((double)1,(double)1,(double)1);
          Tube = new vtkTubeFilter();
          Tube.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          Tube.SetNumberOfSides((int)16);
          Tube.SetCapping((int)0);
          Tube.SetRadius((double)0.2);
          Tube.SetVaryRadius((int)0);
          Tube.SetRadiusFactor((double)10);
          BondsMapper = vtkPolyDataMapper.New();
          BondsMapper.SetInputConnection((vtkAlgorithmOutput)Tube.GetOutputPort());
          BondsMapper.SetImmediateModeRendering((int)1);
          BondsMapper.UseLookupTableScalarRangeOff();
          BondsMapper.SetScalarVisibility((int)1);
          BondsMapper.SetScalarModeToDefault();
          Bonds = new vtkActor();
          Bonds.SetMapper((vtkMapper)BondsMapper);
          Bonds.GetProperty().SetRepresentationToSurface();
          Bonds.GetProperty().SetInterpolationToGouraud();
          Bonds.GetProperty().SetAmbient((double)0.15);
          Bonds.GetProperty().SetDiffuse((double)0.85);
          Bonds.GetProperty().SetSpecular((double)0.1);
          Bonds.GetProperty().SetSpecularPower((double)100);
          Bonds.GetProperty().SetSpecularColor((double)1,(double)1,(double)1);
          Bonds.GetProperty().SetColor((double)1,(double)1,(double)1);
          ren1.AddActor((vtkProp)Bonds);
          ren1.AddActor((vtkProp)Atoms);
          //###################################################[]
          ren1.SetBackground((double)1,(double)1,(double)1);
          ren1.ResetCamera();
          renWin.Render();
          //method moved

          renWin.AbortCheckEvt += new Kitware.VTK.vtkObject.vtkObjectEventHandler(TkCheckAbort_Command.Execute);
          iren.Initialize();

        //deleteAllVTKObjects();
    }
Exemplo n.º 59
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVfieldToUGrid(String [] argv)
    {
        //Prefix Content is: ""

          // Read a field representing unstructured grid and display it (similar to blow.tcl)[]
          // create a reader and write out field daya[]
          reader = new vtkUnstructuredGridReader();
          reader.SetFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/blow.vtk");
          reader.SetScalarsName((string)"thickness9");
          reader.SetVectorsName((string)"displacement9");
          ds2do = new vtkDataSetToDataObjectFilter();
          ds2do.SetInputConnection((vtkAlgorithmOutput)reader.GetOutputPort());
          // we must be able to write here[]
          try
          {
         channel = new StreamWriter("UGridField.vtk");
          tryCatchError = "NOERROR";
          }
          catch(Exception)
          {tryCatchError = "ERROR";}

          if (tryCatchError.Equals("NOERROR"))
          {
          channel.Close();
          write = new vtkDataObjectWriter();
          write.SetInputConnection((vtkAlgorithmOutput)ds2do.GetOutputPort());
          write.SetFileName((string)"UGridField.vtk");
          write.Write();
          // Read the field and convert to unstructured grid.[]
          dor = new vtkDataObjectReader();
          dor.SetFileName((string)"UGridField.vtk");
          do2ds = new vtkDataObjectToDataSetFilter();
          do2ds.SetInputConnection((vtkAlgorithmOutput)dor.GetOutputPort());
          do2ds.SetDataSetTypeToUnstructuredGrid();
          do2ds.SetPointComponent((int)0,(string)"Points",(int)0);
          do2ds.SetPointComponent((int)1,(string)"Points",(int)1);
          do2ds.SetPointComponent((int)2,(string)"Points",(int)2);
          do2ds.SetCellTypeComponent((string)"CellTypes",(int)0);
          do2ds.SetCellConnectivityComponent((string)"Cells",(int)0);
          fd2ad = new vtkFieldDataToAttributeDataFilter();
          fd2ad.SetInput((vtkDataObject)do2ds.GetUnstructuredGridOutput());
          fd2ad.SetInputFieldToDataObjectField();
          fd2ad.SetOutputAttributeDataToPointData();
          fd2ad.SetVectorComponent((int)0,(string)"displacement9",(int)0);
          fd2ad.SetVectorComponent((int)1,(string)"displacement9",(int)1);
          fd2ad.SetVectorComponent((int)2,(string)"displacement9",(int)2);
          fd2ad.SetScalarComponent((int)0,(string)"thickness9",(int)0);
          // Now start visualizing[]
          warp = new vtkWarpVector();
          warp.SetInput((vtkDataObject)fd2ad.GetUnstructuredGridOutput());
          // extract mold from mesh using connectivity[]
          connect = new vtkConnectivityFilter();
          connect.SetInputConnection((vtkAlgorithmOutput)warp.GetOutputPort());
          connect.SetExtractionModeToSpecifiedRegions();
          connect.AddSpecifiedRegion((int)0);
          connect.AddSpecifiedRegion((int)1);
          moldMapper = new vtkDataSetMapper();
          moldMapper.SetInputConnection((vtkAlgorithmOutput)connect.GetOutputPort());
          moldMapper.ScalarVisibilityOff();
          moldActor = new vtkActor();
          moldActor.SetMapper((vtkMapper)moldMapper);
          moldActor.GetProperty().SetColor((double).2,(double).2,(double).2);
          moldActor.GetProperty().SetRepresentationToWireframe();
          // extract parison from mesh using connectivity[]
          connect2 = new vtkConnectivityFilter();
          connect2.SetInputConnection((vtkAlgorithmOutput)warp.GetOutputPort());
          connect2.SetExtractionModeToSpecifiedRegions();
          connect2.AddSpecifiedRegion((int)2);
          parison = new vtkGeometryFilter();
          parison.SetInputConnection((vtkAlgorithmOutput)connect2.GetOutputPort());
          normals2 = new vtkPolyDataNormals();
          normals2.SetInputConnection((vtkAlgorithmOutput)parison.GetOutputPort());
          normals2.SetFeatureAngle((double)60);
          lut = new vtkLookupTable();
          lut.SetHueRange((double)0.0,(double)0.66667);
          parisonMapper = vtkPolyDataMapper.New();
          parisonMapper.SetInputConnection((vtkAlgorithmOutput)normals2.GetOutputPort());
          parisonMapper.SetLookupTable((vtkScalarsToColors)lut);
          parisonMapper.SetScalarRange((double)0.12,(double)1.0);
          parisonActor = new vtkActor();
          parisonActor.SetMapper((vtkMapper)parisonMapper);
          cf = new vtkContourFilter();
          cf.SetInputConnection((vtkAlgorithmOutput)connect2.GetOutputPort());
          cf.SetValue((int)0,(double).5);
          contourMapper = vtkPolyDataMapper.New();
          contourMapper.SetInputConnection((vtkAlgorithmOutput)cf.GetOutputPort());
          contours = new vtkActor();
          contours.SetMapper((vtkMapper)contourMapper);
          // Create graphics stuff[]
          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)moldActor);
          ren1.AddActor((vtkProp)parisonActor);
          ren1.AddActor((vtkProp)contours);
          ren1.ResetCamera();
          ren1.GetActiveCamera().Azimuth((double)60);
          ren1.GetActiveCamera().Roll((double)-90);
          ren1.GetActiveCamera().Dolly((double)2);
          ren1.ResetCameraClippingRange();
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)375,(int)200);
          iren.Initialize();
        }

          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }
Exemplo n.º 60
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVclosedSplines(String [] argv)
    {
        //Prefix Content is: ""

          // get the interactor ui[]
          // Now create the RenderWindow, Renderer and Interactor[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          math = new vtkMath();
          numberOfInputPoints = 30;
          aKSplineX = new vtkKochanekSpline();
          aKSplineX.ClosedOn();
          aKSplineY = new vtkKochanekSpline();
          aKSplineY.ClosedOn();
          aKSplineZ = new vtkKochanekSpline();
          aKSplineZ.ClosedOn();
          aCSplineX = new vtkCardinalSpline();
          aCSplineX.ClosedOn();
          aCSplineY = new vtkCardinalSpline();
          aCSplineY.ClosedOn();
          aCSplineZ = new vtkCardinalSpline();
          aCSplineZ.ClosedOn();
          // add some points[]
          inputPoints = new vtkPoints();
          x = -1.0;
          y = -1.0;
          z = 0.0;
          aKSplineX.AddPoint((double)0,(double)x);
          aKSplineY.AddPoint((double)0,(double)y);
          aKSplineZ.AddPoint((double)0,(double)z);
          aCSplineX.AddPoint((double)0,(double)x);
          aCSplineY.AddPoint((double)0,(double)y);
          aCSplineZ.AddPoint((double)0,(double)z);
          inputPoints.InsertPoint((int)0,(double)x,(double)y,(double)z);
          x = 1.0;
          y = -1.0;
          z = 0.0;
          aKSplineX.AddPoint((double)1,(double)x);
          aKSplineY.AddPoint((double)1,(double)y);
          aKSplineZ.AddPoint((double)1,(double)z);
          aCSplineX.AddPoint((double)1,(double)x);
          aCSplineY.AddPoint((double)1,(double)y);
          aCSplineZ.AddPoint((double)1,(double)z);
          inputPoints.InsertPoint((int)1,(double)x,(double)y,(double)z);
          x = 1.0;
          y = 1.0;
          z = 0.0;
          aKSplineX.AddPoint((double)2,(double)x);
          aKSplineY.AddPoint((double)2,(double)y);
          aKSplineZ.AddPoint((double)2,(double)z);
          aCSplineX.AddPoint((double)2,(double)x);
          aCSplineY.AddPoint((double)2,(double)y);
          aCSplineZ.AddPoint((double)2,(double)z);
          inputPoints.InsertPoint((int)2,(double)x,(double)y,(double)z);
          x = -1.0;
          y = 1.0;
          z = 0.0;
          aKSplineX.AddPoint((double)3,(double)x);
          aKSplineY.AddPoint((double)3,(double)y);
          aKSplineZ.AddPoint((double)3,(double)z);
          aCSplineX.AddPoint((double)3,(double)x);
          aCSplineY.AddPoint((double)3,(double)y);
          aCSplineZ.AddPoint((double)3,(double)z);
          inputPoints.InsertPoint((int)3,(double)x,(double)y,(double)z);
          inputData = new vtkPolyData();
          inputData.SetPoints((vtkPoints)inputPoints);
          balls = new vtkSphereSource();
          balls.SetRadius((double).04);
          balls.SetPhiResolution((int)10);
          balls.SetThetaResolution((int)10);
          glyphPoints = new vtkGlyph3D();
          glyphPoints.SetInput((vtkDataObject)inputData);
          glyphPoints.SetSource((vtkPolyData)balls.GetOutput());
          glyphMapper = vtkPolyDataMapper.New();
          glyphMapper.SetInputConnection((vtkAlgorithmOutput)glyphPoints.GetOutputPort());
          glyph = new vtkActor();
          glyph.SetMapper((vtkMapper)glyphMapper);
          glyph.GetProperty().SetDiffuseColor((double) 1.0000, 0.3882, 0.2784 );
          glyph.GetProperty().SetSpecular((double).3);
          glyph.GetProperty().SetSpecularPower((double)30);
          ren1.AddActor((vtkProp)glyph);
          Kpoints = new vtkPoints();
          Cpoints = new vtkPoints();
          profileKData = new vtkPolyData();
          profileCData = new vtkPolyData();
          numberOfInputPoints = 5;
          numberOfOutputPoints = 100;
          offset = 1.0;
          //method moved
          fit();
          lines = new vtkCellArray();
          lines.InsertNextCell((int)numberOfOutputPoints);
          i = 0;
          while((i) < numberOfOutputPoints)
        {
          lines.InsertCellPoint((int)i);
          i = i + 1;
        }

          profileKData.SetPoints((vtkPoints)Kpoints);
          profileKData.SetLines((vtkCellArray)lines);
          profileCData.SetPoints((vtkPoints)Cpoints);
          profileCData.SetLines((vtkCellArray)lines);
          profileKTubes = new vtkTubeFilter();
          profileKTubes.SetNumberOfSides((int)8);
          profileKTubes.SetInput((vtkDataObject)profileKData);
          profileKTubes.SetRadius((double).01);
          profileKMapper = vtkPolyDataMapper.New();
          profileKMapper.SetInputConnection((vtkAlgorithmOutput)profileKTubes.GetOutputPort());
          profileK = new vtkActor();
          profileK.SetMapper((vtkMapper)profileKMapper);
          profileK.GetProperty().SetDiffuseColor((double) 0.8900, 0.8100, 0.3400 );
          profileK.GetProperty().SetSpecular((double).3);
          profileK.GetProperty().SetSpecularPower((double)30);
          ren1.AddActor((vtkProp)profileK);
          profileCTubes = new vtkTubeFilter();
          profileCTubes.SetNumberOfSides((int)8);
          profileCTubes.SetInput((vtkDataObject)profileCData);
          profileCTubes.SetRadius((double).01);
          profileCMapper = vtkPolyDataMapper.New();
          profileCMapper.SetInputConnection((vtkAlgorithmOutput)profileCTubes.GetOutputPort());
          profileC = new vtkActor();
          profileC.SetMapper((vtkMapper)profileCMapper);
          profileC.GetProperty().SetDiffuseColor((double) 0.2000, 0.6300, 0.7900 );
          profileC.GetProperty().SetSpecular((double).3);
          profileC.GetProperty().SetSpecularPower((double)30);
          ren1.AddActor((vtkProp)profileC);
          ren1.ResetCamera();
          ren1.GetActiveCamera().Dolly((double)1.5);
          ren1.ResetCameraClippingRange();
          renWin.SetSize((int)300,(int)300);
          // render the image[]
          //[]
          iren.Initialize();
          // prevent the tk window from showing up then start the event loop[]
          //method moved
          //method moved
          //method moved
          //method moved
          //method moved
          //method moved

        //deleteAllVTKObjects();
    }