Ejemplo n.º 1
0
        public void ExtractEdgesVTKBuilderWithoutRunning(ref vtkActor actor, ref vtkPoints points, ref vtkCellArray polys,
                                                         ref vtkFloatArray scalars, ref vtkLookupTable Luk)
        {
            int pointsNum = 0;

            TowerModelInstance.VTKDrawModel(ref points, ref polys, ref scalars, ref pointsNum, paras);

            vtkPolyData profile = vtkPolyData.New();

            profile.SetPoints(points);
            profile.SetPolys(polys);

            vtkExtractEdges ExtProfile = new vtkExtractEdges();


            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            if (paras.RotateAngle == 0)
            {
                profile.GetCellData().SetScalars(scalars);
                ExtProfile.SetInput(profile);
                mapper.SetInputConnection(ExtProfile.GetOutputPort());
            }
            else
            {
                vtkRotationalExtrusionFilter refilter = vtkRotationalExtrusionFilter.New();
                profile.Update();
                profile.GetCellData().SetScalars(scalars);
                //profile.GetPointData().SetScalars(scalars);
                ExtProfile.SetInput(profile);

                refilter.SetInputConnection(ExtProfile.GetOutputPort());
                refilter.SetResolution(50);
                refilter.SetAngle(paras.RotateAngle);
                refilter.SetTranslation(0);
                refilter.SetDeltaRadius(0);

                mapper.SetInputConnection(refilter.GetOutputPort());
            }
            mapper.SetScalarRange(0, 5);
            mapper.SetLookupTable(Luk);
            actor.SetMapper(mapper);

            Luk.SetNumberOfTableValues(7);
            Luk.SetTableValue(0, 0, 1, 0, 1);   //
            Luk.SetTableValue(1, 0, 0, 0.8, 1); //inner surface
            Luk.SetTableValue(2, 0, 1, 0, 1);   //
            Luk.SetTableValue(3, 0, 0, 1, 1);
            Luk.SetTableValue(4, 0, 0, 0.8, 1); //insider
            Luk.SetTableValue(5, 0, 0.8, 0, 1); //outer surface
            Luk.Build();
        }
Ejemplo n.º 2
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);
        }