Ejemplo n.º 1
0
        public void AddCylinderEdgeToActors(byte[] bgColor, ref vtkActorCollection actors)
        {
            vtkProperty pp = vtkProperty.New();

            pp.SetOpacity(0.7);
            pp.SetColor(bgColor[0], bgColor[1], bgColor[2]);
            pp.SetLineWidth(5);
            pp.SetLighting(false);

            vtkRegularPolygonSource circle = vtkRegularPolygonSource.New();

            circle.GeneratePolygonOn();
            circle.SetNumberOfSides(50);
            circle.SetRadius(radius);
            circle.SetCenter(0, 0, 0);

            vtkPolyDataMapper mappper = vtkPolyDataMapper.New();

            mappper.SetInputConnection(circle.GetOutputPort());

            vtkActor actor = vtkActor.New();

            actor.SetProperty(pp);
            actor.SetMapper(mappper);
            actors.AddItem(actor);

            actor.SetProperty(pp);
            actors.AddItem(actor);


            vtkLineSource ls = vtkLineSource.New();

            ls.SetPoint1(0, 0, 0);
            ls.SetPoint2(0, 0, height);
            vtkTubeFilter tf = vtkTubeFilter.New();

            tf.SetInputConnection(ls.GetOutputPort());
            tf.SetRadius(radius);
            tf.SetNumberOfSides(100);
            tf.CappingOff();

            vtkPolyDataMapper dm = vtkPolyDataMapper.New();

            dm.SetInputConnection(tf.GetOutputPort());

            vtkActor a2 = vtkActor.New();

            a2.SetMapper(dm);

            a2.SetProperty(pp);

            pp.SetOpacity(0.5);
            actor.SetProperty(pp);

            actors.AddItem(a2);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
            vtkRenderWindow renderWindow = renderWindowControl1.RenderWindow;
            vtkRenderer     renderer     = renderWindow.GetRenderers().GetFirstRenderer();

            renderer.SetBackground(0.2, 0.3, 0.4);
            renderer.AddActor(actor);
        }