Example #1
0
        public Sphere(ARenderable parent)
            : base(parent)
        {
            Name   = "Sphere";
            sphere = vtkSphereSource.New();
            sphere.SetThetaResolution(8);
            sphere.SetPhiResolution(16);

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

            move = vtkTransform.New();
            move.Translate(_random.NextDouble(), _random.NextDouble(), _random.NextDouble());
            moveFilter = vtkTransformPolyDataFilter.New();
            moveFilter.SetTransform(move);

            moveFilter.SetInputConnection(shrink.GetOutputPort());

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

            Actors = new ObservableCollection <vtkActor>();
            // The actor links the data pipeline to the rendering subsystem
            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetColor(1, 0, 0);
            Actors.Add(actor);
        }
Example #2
0
        public Cone(ARenderable parent)
            : base(parent)
        {
            Name = "Cone";
            cone = vtkConeSource.New();
            cone.SetAngle(10);
            cone.SetRadius(0.2);
            cone.SetHeight(0.5);
            cone.SetResolution(20);

            move = vtkTransform.New();
            move.Translate(_random.NextDouble(), _random.NextDouble(), _random.NextDouble());
            moveFilter = vtkTransformPolyDataFilter.New();
            moveFilter.SetTransform(move);

            moveFilter.SetInputConnection(cone.GetOutputPort());
            mapper = vtkPolyDataMapper.New();
            mapper.SetInputConnection(moveFilter.GetOutputPort());

            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);

            Actors = new ObservableCollection <vtkActor>();
            Actors.Add(actor);
        }
Example #3
0
        static public vtkAlgorithmOutput genFrustumCone(double total_dis, double end_radius,
                                                        double distance, bool is_reverse)
        {
            vtkConeSource cone = vtkConeSource.New();

            cone.SetHeight(total_dis * 1.2);
            cone.SetRadius(end_radius * 1.2);
            cone.SetCenter(0, 0, total_dis * 0.4);
            cone.SetResolution(80);
            cone.SetDirection(0, 0, 1);
            cone.Update();

            vtkPlane plane = vtkPlane.New();

            plane.SetOrigin(0, 0, 0);
            plane.SetNormal(0, 0, 1);

            vtkClipPolyData clipPolyData = vtkClipPolyData.New();

            clipPolyData.SetInputConnection(cone.GetOutputPort());
            clipPolyData.SetClipFunction(plane);
            clipPolyData.GenerateClippedOutputOn();
            clipPolyData.Update();

            vtkPlane plane2 = vtkPlane.New();

            plane2.SetOrigin(0, 0, distance);
            plane2.SetNormal(0, 0, -1);

            vtkClipPolyData clipPolyData2 = vtkClipPolyData.New();

            clipPolyData2.SetInputConnection(clipPolyData.GetOutputPort());
            clipPolyData2.SetClipFunction(plane2);
            clipPolyData2.GenerateClippedOutputOn();
            clipPolyData2.Update();

            if (is_reverse)
            {
                vtkTransform transform = vtkTransform.New();
                transform.RotateWXYZ(180, 0, 1, 0);
                transform.Translate(0, 0, -distance);

                vtkTransformPolyDataFilter transFilter = vtkTransformPolyDataFilter.New();
                transFilter.SetInputConnection(clipPolyData2.GetOutputPort());
                transFilter.SetTransform(transform); //use vtkTransform (or maybe vtkLinearTransform)
                transFilter.Update();
                return(transFilter.GetOutputPort());
            }
            return(clipPolyData2.GetOutputPort());
        }
Example #4
0
        static public vtkProp3D genActor(List <GaussianCluster> data)
        {
            vtkProperty pro = new vtkProperty();

            // 默认颜色
            pro.SetColor(config.cone_color[0], config.cone_color[1],
                         config.cone_color[2]);
            pro.SetOpacity(0.4);
            vtkAppendPolyData polydata = vtkAppendPolyData.New();

            for (int i = 1; i < data.Count; i++)
            {
                var cluster = data[i];
                System.Windows.Forms.MessageBox.Show("cluster.start_radius:" + cluster.start_radius.ToString() +
                                                     "cluster.distance:" + cluster.distance.ToString() +
                                                     "cluster.is_foucs:" + cluster.is_foucs.ToString() +
                                                     "cluster.foucs_radius:" + cluster.foucs_radius.ToString());
                vtkTransform transform = vtkTransform.New();
                transform.Translate(cluster.coordinate.pos.x, cluster.coordinate.pos.y, cluster.coordinate.pos.z);
                transform.RotateWXYZ(cluster.coordinate.rotate_theta, cluster.coordinate.rotate_axis.x,
                                     cluster.coordinate.rotate_axis.y, cluster.coordinate.rotate_axis.z);

                vtkTransformPolyDataFilter transFilter = vtkTransformPolyDataFilter.New();
                transFilter.SetInputConnection(combiFrustumCone(cluster.start_radius,
                                                                1, cluster.angle, true, 0.01));
                transFilter.SetTransform(transform);
                transFilter.Update();
                polydata.AddInputConnection(transFilter.GetOutputPort());
            }

            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(polydata.GetOutputPort());
            mapper.ScalarVisibilityOff();
            // The actor links the data pipeline to the rendering subsystem
            vtkActor actor = vtkActor.New();

            actor.SetProperty(pro);
            actor.SetMapper(mapper);
            return(actor);
        }
Example #5
0
        static public vtkAlgorithmOutput combiFrustumCone(double start_radius, double distance,
                                                          double angle, bool is_foucs, double foucs_radius)
        {
            double tanArc     = Math.Tan(Math.PI * angle / 180);
            double origin_dis = start_radius / tanArc;

            if (is_foucs) // 缩小
            {
                double origin_foucs_dis = foucs_radius / tanArc;
                double fouce_dis        = origin_dis - origin_foucs_dis;
                if (distance > fouce_dis) //缩小到焦点后放大
                {
                    vtkAppendPolyData polydata = vtkAppendPolyData.New();
                    polydata.AddInputConnection(genFrustumCone(origin_dis, start_radius, fouce_dis, false));
                    vtkTransform transform = vtkTransform.New();
                    transform.Translate(0, 0, fouce_dis);

                    vtkTransformPolyDataFilter transFilter = vtkTransformPolyDataFilter.New();
                    origin_dis = origin_foucs_dis + distance - fouce_dis;
                    transFilter.SetInputConnection(genFrustumCone(origin_dis, origin_dis * tanArc, distance - fouce_dis, true));
                    transFilter.SetTransform(transform); //use vtkTransform (or maybe vtkLinearTransform)
                    transFilter.Update();
                    polydata.AddInputConnection(transFilter.GetOutputPort());
                    polydata.Update();
                    return(polydata.GetOutputPort());
                }
                else
                {
                    return(genFrustumCone(origin_dis, start_radius, distance, false));
                }
            }
            else // 放大
            {
                double total_dis  = origin_dis + distance;
                double end_radius = total_dis * tanArc;

                return(genFrustumCone(total_dis, end_radius, distance, true));
            }
        }
Example #6
0
        static public vtkProp3D genCylinderActor(CompontData data, vtkProperty pro)
        {
            double            r        = data.param[0];
            double            h        = data.param[1];
            vtkCylinderSource cylinder = vtkCylinderSource.New();

            cylinder.SetHeight(h);
            cylinder.SetRadius(r);
            cylinder.SetCenter(0, h / 2, 0);
            cylinder.SetResolution(40);
            cylinder.Update();
            vtkTransform transform = vtkTransform.New();

            transform.RotateWXYZ(90, 1, 0, 0);

            vtkTransformPolyDataFilter transFilter = vtkTransformPolyDataFilter.New();

            transFilter.SetInputConnection(cylinder.GetOutputPort());
            transFilter.SetTransform(transform); //use vtkTransform (or maybe vtkLinearTransform)
            transFilter.Update();

            return(genUserActor(data, transFilter.GetOutputPort(), pro));
        }
Example #7
0
        static public vtkProp3D genUserActor(CompontData data, vtkAlgorithmOutput vtkAlgorithmOutput,
                                             vtkProperty pro)
        {
            vtkTransform transform = vtkTransform.New();

            // 用户自定义平移旋转 (先移动后旋转)
            transform.Translate(data.coor.pos.x, data.coor.pos.y, data.coor.pos.z);
            transform.RotateWXYZ(data.coor.rotate_theta, data.coor.rotate_axis.x, data.coor.rotate_axis.y, data.coor.rotate_axis.z);

            vtkTransformPolyDataFilter transFilter = vtkTransformPolyDataFilter.New();

            transFilter.SetInputConnection(vtkAlgorithmOutput);
            transFilter.SetTransform(transform); //use vtkTransform (or maybe vtkLinearTransform)
            transFilter.Update();

            //vtkShrinkPolyData shrink = vtkShrinkPolyData.New();
            //shrink.SetInputConnection(transFilter.GetOutputPort());
            //shrink.SetShrinkFactor(1);

            // 改
            //vtkSTLWriter writer = vtkSTLWriter.New();
            //calPolyData(polyData, 0.01);
            //writer.SetInputConnection(transFilter.GetOutputPort());
            //writer.SetFileName("test.stl");
            //writer.Update();

            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            mapper.SetInputConnection(transFilter.GetOutputPort());
            mapper.ScalarVisibilityOff();
            // The actor links the data pipeline to the rendering subsystem
            vtkActor actor = vtkActor.New();

            actor.SetProperty(pro);
            actor.SetMapper(mapper);
            return(actor);
        }
    /// <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();
    }
Example #9
0
        private void OrientedArrow()
        {
            //Create an arrow.
            vtkArrowSource arrowSource = vtkArrowSource.New();

            // Generate a random start and end point
            vtkMath.RandomSeed(8775070);
            double[] startPoint = new double[] {
                vtkMath.Random(-10, 10),
                vtkMath.Random(-10, 10),
                vtkMath.Random(-10, 10)
            };

            double[] endPoint = new double[] {
                vtkMath.Random(-10, 10),
                vtkMath.Random(-10, 10),
                vtkMath.Random(-10, 10)
            };

            // Compute a basis
            double[] normalizedX = new double[3];
            double[] normalizedY = new double[3];
            double[] normalizedZ = new double[3];

            // The X axis is a vector from start to end
            myMath.Subtract(endPoint, startPoint, ref normalizedX);
            double length = myMath.Norm(normalizedX);

            myMath.Normalize(ref normalizedX);

            // The Z axis is an arbitrary vector cross X
            double[] arbitrary = new double[] {
                vtkMath.Random(-10, 10),
                vtkMath.Random(-10, 10),
                vtkMath.Random(-10, 10)
            };
            myMath.Cross(normalizedX, arbitrary, ref normalizedZ);
            myMath.Normalize(ref normalizedZ);
            // The Y axis is Z cross X
            myMath.Cross(normalizedZ, normalizedX, ref normalizedY);
            vtkMatrix4x4 matrix = vtkMatrix4x4.New();

            // Create the direction cosine matrix
            matrix.Identity();
            for (int i = 0; i < 3; i++)
            {
                matrix.SetElement(i, 0, normalizedX[i]);
                matrix.SetElement(i, 1, normalizedY[i]);
                matrix.SetElement(i, 2, normalizedZ[i]);
            }

            // Apply the transforms
            vtkTransform transform = vtkTransform.New();

            transform.Translate(startPoint[0], startPoint[1], startPoint[2]);
            transform.Concatenate(matrix);
            transform.Scale(length, length, length);


            //Create a mapper and actor for the arrow
            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
            vtkActor          actor  = vtkActor.New();

#if USER_MATRIX
            mapper.SetInputConnection(arrowSource.GetOutputPort());
            actor.SetUserMatrix(transform.GetMatrix());
#else
            // Transform the polydata
            vtkTransformPolyDataFilter transformPD = vtkTransformPolyDataFilter.New();
            transformPD.SetTransform(transform);
            transformPD.SetInputConnection(arrowSource.GetOutputPort());
            mapper.SetInputConnection(transformPD.GetOutputPort());
#endif
            actor.SetMapper(mapper);

            // Create spheres for start and end point
            vtkSphereSource sphereStartSource = vtkSphereSource.New();
            sphereStartSource.SetCenter(startPoint[0], startPoint[1], startPoint[2]);
            vtkPolyDataMapper sphereStartMapper = vtkPolyDataMapper.New();
            sphereStartMapper.SetInputConnection(sphereStartSource.GetOutputPort());
            vtkActor sphereStart = vtkActor.New();
            sphereStart.SetMapper(sphereStartMapper);
            sphereStart.GetProperty().SetColor(1.0, 1.0, .3);

            vtkSphereSource sphereEndSource = vtkSphereSource.New();
            sphereEndSource.SetCenter(endPoint[0], endPoint[1], endPoint[2]);
            vtkPolyDataMapper sphereEndMapper = vtkPolyDataMapper.New();
            sphereEndMapper.SetInputConnection(sphereEndSource.GetOutputPort());
            vtkActor sphereEnd = vtkActor.New();
            sphereEnd.SetMapper(sphereEndMapper);
            sphereEnd.GetProperty().SetColor(1.0, .3, .3);

            vtkRenderWindow renderWindow = myRenderWindowControl.RenderWindow;
            vtkRenderer     renderer     = renderWindow.GetRenderers().GetFirstRenderer();
            renderer.SetBackground(0.2, 0.3, 0.4);
            renderer.AddActor(actor);
            renderer.AddActor(sphereStart);
            renderer.AddActor(sphereEnd);
            renderer.ResetCamera();
        }
Example #10
0
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVprobeComb(String [] argv)
    {
        //Prefix Content is: ""

        // create planes[]
        // Create the RenderWindow, Renderer and both Actors[]
        //[]
        ren1   = vtkRenderer.New();
        renWin = vtkRenderWindow.New();
        renWin.SetMultiSamples(0);
        renWin.AddRenderer((vtkRenderer)ren1);
        iren = new vtkRenderWindowInteractor();
        iren.SetRenderWindow((vtkRenderWindow)renWin);
        // create pipeline[]
        //[]
        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();
        plane = new vtkPlaneSource();
        plane.SetResolution((int)50, (int)50);
        transP1 = new vtkTransform();
        transP1.Translate((double)3.7, (double)0.0, (double)28.37);
        transP1.Scale((double)5, (double)5, (double)5);
        transP1.RotateY((double)90);
        tpd1 = new vtkTransformPolyDataFilter();
        tpd1.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
        tpd1.SetTransform((vtkAbstractTransform)transP1);
        outTpd1 = new vtkOutlineFilter();
        outTpd1.SetInputConnection((vtkAlgorithmOutput)tpd1.GetOutputPort());
        mapTpd1 = vtkPolyDataMapper.New();
        mapTpd1.SetInputConnection((vtkAlgorithmOutput)outTpd1.GetOutputPort());
        tpd1Actor = new vtkActor();
        tpd1Actor.SetMapper((vtkMapper)mapTpd1);
        tpd1Actor.GetProperty().SetColor((double)0, (double)0, (double)0);
        transP2 = new vtkTransform();
        transP2.Translate((double)9.2, (double)0.0, (double)31.20);
        transP2.Scale((double)5, (double)5, (double)5);
        transP2.RotateY((double)90);
        tpd2 = new vtkTransformPolyDataFilter();
        tpd2.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
        tpd2.SetTransform((vtkAbstractTransform)transP2);
        outTpd2 = new vtkOutlineFilter();
        outTpd2.SetInputConnection((vtkAlgorithmOutput)tpd2.GetOutputPort());
        mapTpd2 = vtkPolyDataMapper.New();
        mapTpd2.SetInputConnection((vtkAlgorithmOutput)outTpd2.GetOutputPort());
        tpd2Actor = new vtkActor();
        tpd2Actor.SetMapper((vtkMapper)mapTpd2);
        tpd2Actor.GetProperty().SetColor((double)0, (double)0, (double)0);
        transP3 = new vtkTransform();
        transP3.Translate((double)13.27, (double)0.0, (double)33.30);
        transP3.Scale((double)5, (double)5, (double)5);
        transP3.RotateY((double)90);
        tpd3 = new vtkTransformPolyDataFilter();
        tpd3.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
        tpd3.SetTransform((vtkAbstractTransform)transP3);
        outTpd3 = new vtkOutlineFilter();
        outTpd3.SetInputConnection((vtkAlgorithmOutput)tpd3.GetOutputPort());
        mapTpd3 = vtkPolyDataMapper.New();
        mapTpd3.SetInputConnection((vtkAlgorithmOutput)outTpd3.GetOutputPort());
        tpd3Actor = new vtkActor();
        tpd3Actor.SetMapper((vtkMapper)mapTpd3);
        tpd3Actor.GetProperty().SetColor((double)0, (double)0, (double)0);
        appendF = new vtkAppendPolyData();
        appendF.AddInputConnection(tpd1.GetOutputPort());
        appendF.AddInputConnection(tpd2.GetOutputPort());
        appendF.AddInputConnection(tpd3.GetOutputPort());
        probe = new vtkProbeFilter();
        probe.SetInputConnection((vtkAlgorithmOutput)appendF.GetOutputPort());
        probe.SetSourceData((vtkDataSet)pl3d.GetOutput().GetBlock(0));
        contour = new vtkContourFilter();
        contour.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort());
        contour.GenerateValues((int)50, (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                               (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        contourMapper = vtkPolyDataMapper.New();
        contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort());
        contourMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[0],
                                     (double)((vtkDataSet)pl3d.GetOutput().GetBlock(0)).GetScalarRange()[1]);
        planeActor = new vtkActor();
        planeActor.SetMapper((vtkMapper)contourMapper);
        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);
        outlineActor.GetProperty().SetColor((double)0, (double)0, (double)0);
        ren1.AddActor((vtkProp)outlineActor);
        ren1.AddActor((vtkProp)planeActor);
        ren1.AddActor((vtkProp)tpd1Actor);
        ren1.AddActor((vtkProp)tpd2Actor);
        ren1.AddActor((vtkProp)tpd3Actor);
        ren1.SetBackground((double)1, (double)1, (double)1);
        renWin.SetSize((int)400, (int)400);
        cam1 = ren1.GetActiveCamera();
        cam1.SetClippingRange((double)3.95297, (double)50);
        cam1.SetFocalPoint((double)8.88908, (double)0.595038, (double)29.3342);
        cam1.SetPosition((double)-12.3332, (double)31.7479, (double)41.2387);
        cam1.SetViewUp((double)0.060772, (double)-0.319905, (double)0.945498);
        iren.Initialize();
        // prevent the tk window from showing up then start the event loop[]

//deleteAllVTKObjects();
    }
Example #11
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();
    }
    /// <summary>
    /// The main entry method called by the CSharp driver
    /// </summary>
    /// <param name="argv"></param>
    public static void AVprobeComb(String [] argv)
    {
        //Prefix Content is: ""

          // create planes[]
          // Create the RenderWindow, Renderer and both Actors[]
          //[]
          ren1 = vtkRenderer.New();
          renWin = vtkRenderWindow.New();
          renWin.AddRenderer((vtkRenderer)ren1);
          iren = new vtkRenderWindowInteractor();
          iren.SetRenderWindow((vtkRenderWindow)renWin);
          // create pipeline[]
          //[]
          pl3d = new vtkPLOT3DReader();
          pl3d.SetXYZFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combxyz.bin");
          pl3d.SetQFileName((string)"" + (VTK_DATA_ROOT.ToString()) + "/Data/combq.bin");
          pl3d.SetScalarFunctionNumber((int)100);
          pl3d.SetVectorFunctionNumber((int)202);
          pl3d.Update();
          plane = new vtkPlaneSource();
          plane.SetResolution((int)50,(int)50);
          transP1 = new vtkTransform();
          transP1.Translate((double)3.7,(double)0.0,(double)28.37);
          transP1.Scale((double)5,(double)5,(double)5);
          transP1.RotateY((double)90);
          tpd1 = new vtkTransformPolyDataFilter();
          tpd1.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          tpd1.SetTransform((vtkAbstractTransform)transP1);
          outTpd1 = new vtkOutlineFilter();
          outTpd1.SetInputConnection((vtkAlgorithmOutput)tpd1.GetOutputPort());
          mapTpd1 = vtkPolyDataMapper.New();
          mapTpd1.SetInputConnection((vtkAlgorithmOutput)outTpd1.GetOutputPort());
          tpd1Actor = new vtkActor();
          tpd1Actor.SetMapper((vtkMapper)mapTpd1);
          tpd1Actor.GetProperty().SetColor((double)0,(double)0,(double)0);
          transP2 = new vtkTransform();
          transP2.Translate((double)9.2,(double)0.0,(double)31.20);
          transP2.Scale((double)5,(double)5,(double)5);
          transP2.RotateY((double)90);
          tpd2 = new vtkTransformPolyDataFilter();
          tpd2.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          tpd2.SetTransform((vtkAbstractTransform)transP2);
          outTpd2 = new vtkOutlineFilter();
          outTpd2.SetInputConnection((vtkAlgorithmOutput)tpd2.GetOutputPort());
          mapTpd2 = vtkPolyDataMapper.New();
          mapTpd2.SetInputConnection((vtkAlgorithmOutput)outTpd2.GetOutputPort());
          tpd2Actor = new vtkActor();
          tpd2Actor.SetMapper((vtkMapper)mapTpd2);
          tpd2Actor.GetProperty().SetColor((double)0,(double)0,(double)0);
          transP3 = new vtkTransform();
          transP3.Translate((double)13.27,(double)0.0,(double)33.30);
          transP3.Scale((double)5,(double)5,(double)5);
          transP3.RotateY((double)90);
          tpd3 = new vtkTransformPolyDataFilter();
          tpd3.SetInputConnection((vtkAlgorithmOutput)plane.GetOutputPort());
          tpd3.SetTransform((vtkAbstractTransform)transP3);
          outTpd3 = new vtkOutlineFilter();
          outTpd3.SetInputConnection((vtkAlgorithmOutput)tpd3.GetOutputPort());
          mapTpd3 = vtkPolyDataMapper.New();
          mapTpd3.SetInputConnection((vtkAlgorithmOutput)outTpd3.GetOutputPort());
          tpd3Actor = new vtkActor();
          tpd3Actor.SetMapper((vtkMapper)mapTpd3);
          tpd3Actor.GetProperty().SetColor((double)0,(double)0,(double)0);
          appendF = new vtkAppendPolyData();
          appendF.AddInput((vtkPolyData)tpd1.GetOutput());
          appendF.AddInput((vtkPolyData)tpd2.GetOutput());
          appendF.AddInput((vtkPolyData)tpd3.GetOutput());
          probe = new vtkProbeFilter();
          probe.SetInputConnection((vtkAlgorithmOutput)appendF.GetOutputPort());
          probe.SetSource((vtkDataObject)pl3d.GetOutput());
          contour = new vtkContourFilter();
          contour.SetInputConnection((vtkAlgorithmOutput)probe.GetOutputPort());
          contour.GenerateValues((int)50,(double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
          contourMapper = vtkPolyDataMapper.New();
          contourMapper.SetInputConnection((vtkAlgorithmOutput)contour.GetOutputPort());
          contourMapper.SetScalarRange((double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[0],
          (double)((vtkDataSet)pl3d.GetOutput()).GetScalarRange()[1]);
          planeActor = new vtkActor();
          planeActor.SetMapper((vtkMapper)contourMapper);
          outline = new vtkStructuredGridOutlineFilter();
          outline.SetInputConnection((vtkAlgorithmOutput)pl3d.GetOutputPort());
          outlineMapper = vtkPolyDataMapper.New();
          outlineMapper.SetInputConnection((vtkAlgorithmOutput)outline.GetOutputPort());
          outlineActor = new vtkActor();
          outlineActor.SetMapper((vtkMapper)outlineMapper);
          outlineActor.GetProperty().SetColor((double)0,(double)0,(double)0);
          ren1.AddActor((vtkProp)outlineActor);
          ren1.AddActor((vtkProp)planeActor);
          ren1.AddActor((vtkProp)tpd1Actor);
          ren1.AddActor((vtkProp)tpd2Actor);
          ren1.AddActor((vtkProp)tpd3Actor);
          ren1.SetBackground((double)1,(double)1,(double)1);
          renWin.SetSize((int)400,(int)400);
          cam1 = ren1.GetActiveCamera();
          cam1.SetClippingRange((double)3.95297,(double)50);
          cam1.SetFocalPoint((double)8.88908,(double)0.595038,(double)29.3342);
          cam1.SetPosition((double)-12.3332,(double)31.7479,(double)41.2387);
          cam1.SetViewUp((double)0.060772,(double)-0.319905,(double)0.945498);
          iren.Initialize();
          // prevent the tk window from showing up then start the event loop[]

        //deleteAllVTKObjects();
    }