[vtkusers] ActiViz | Update Actor

Matias Montroull matimontg at gmail.com
Tue Mar 25 17:34:40 EDT 2014


Hi,

I have a project where I load a set of points and then I show them in
screen.

This works just fine, now, there's also a function where I modify the
points position in real time.

How can I update the viewer with the new points?

I have 2 actors, one of them are the points that I modify so I don't want
to update the whole scene, just the actor with the modified points.


string filePath = @"C:/tracker/registracion_por_superficie.poi";
fs = new FileStream(filePath, FileMode.Open, FileAccess.Read,
FileShare.ReadWrite);
            sr = new StreamReader(fs);
            vtkPoints points_registracion = vtkPoints.New();
            while (!sr.EndOfStream)
            {
                Buffer_Linea = sr.ReadLine();
                sXYZ = Buffer_Linea.Split(chDelimiter,
StringSplitOptions.RemoveEmptyEntries);
                //Reg por Superficie original
                xyz[0] = double.Parse(sXYZ[3],
CultureInfo.InvariantCulture);
                xyz[1] = double.Parse(sXYZ[4],
CultureInfo.InvariantCulture);
                xyz[2] = double.Parse(sXYZ[5],
CultureInfo.InvariantCulture);
                points_registracion.InsertNextPoint(xyz[0], xyz[1], xyz[2]);
            }
            sr.Close();

            vtkPolyData polydata_registracion = vtkPolyData.New();
            polydata_registracion.SetPoints(points_registracion);

            vtkVertexGlyphFilter glyphFilter_registracion =
vtkVertexGlyphFilter.New();

glyphFilter_registracion.SetInputConnection(polydata_registracion.GetProducerPort());
            glyphFilter_registracion.Update();

            vtkPolyDataMapper registracion_mapper = vtkPolyDataMapper.New();

registracion_mapper.SetInputConnection(glyphFilter_registracion.GetOutputPort());
            vtkActor actor_registracion = vtkActor.New();
            actor_registracion.SetMapper(registracion_mapper);
            actor_registracion.GetProperty().SetPointSize(8);
            actor_registracion.GetProperty().SetColor(255, 0, 0);


// add render and actor:
     vtkRenderer render =
vtkRenderer.New();//renderWindowControl1.RenderWindow.GetRenderers().GetFirstRenderer();
;
            vtkRenderWindow renwin = vtkRenderWindow.New();
            renwin.AddRenderer(render);
            vtkRenderWindowInteractor iren =
vtkRenderWindowInteractor.New();
            iren.SetRenderWindow(renwin);
            renwin.PointSmoothingOn();

            render.AddActor(actor_registracion);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140325/1596f60f/attachment.html>


More information about the vtkusers mailing list