[vtkusers] ActiViz | Update Actor

Matias Montroull matimontg at gmail.com
Tue Mar 25 18:15:47 EDT 2014


Can I just remove the actor and add a new one (which will show the updated
points)?


On Tue, Mar 25, 2014 at 6:34 PM, Matias Montroull <matimontg at gmail.com>wrote:

> 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/0eb62de1/attachment.html>


More information about the vtkusers mailing list