[vtkusers] vtkPolyLine - Add new points dynamically?

Markus Ott ott-markus at t-online.de
Mon Jul 26 07:10:50 EDT 2010


Thanks Eric, this sounds great.

I tried it but think i made a mistake somewhere.
Does anybody see my error? (Java snippet below)

		points = new vtkPoints();
	
		double origin[] = {0.0, 0.3, 0.1};
		double p0[] = {1.0, 0.5, 0.8};
		double p1[] = {0.3, 0.4, 0.7};
		double p2[] = {0.4, 0.2, 0.2};
		double p3[] = {0.4, 0.8, 0.3};
		
		points.InsertNextPoint(origin);
		points.InsertNextPoint(p0);
		points.InsertNextPoint(p1);
		points.InsertNextPoint(p2);
		points.InsertNextPoint(p3);
		
		polyData = new vtkPolyData();
		polyData.SetPoints(points);
		polyData.BuildCells();
		
		path = new vtkTemporalPathLineFilter();
		path.UsePointIndexForIdsOn();
		path.SetInput(polyData);
	

		vtkPolyDataMapper mapper = new vtkPolyDataMapper();
		mapper.SetInputConnection(path.GetOutputPort());
	
		traceActor = new vtkActor();
		traceActor.SetMapper(mapper);	
		traceActor.VisibilityOn();		

		VisualizationPanel.getInstance().addActor(traceActor);

Eric E. Monson schrieb:
> Hey Markus,
> 
> I don't know if this will quite work for your application, but in case you didn't know about it, there is the vtkTemporalPathLineFilter:
> 
> http://www.vtk.org/doc/nightly/html/classvtkTemporalPathLineFilter.html
> 
> I haven't looked through the code, but it may help with your methods. I use it in ParaView all the time to trace out particle paths in time-dependent data sets.
> 
> -Eric
> 
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
> 
> 
> On Jul 26, 2010, at 10:15 AM, Markus Ott wrote:
> 
>> Hi vtkusers.
>>
>> What i want to do is some kind of real time position tracing. An object
>> moves through 3d space and I want to trace this movement with a line.
>>
>> I read the polyline example
>> (http://vtk.org/Wiki/VTK/Examples/GeometricObjects/Display/PolyLine)
>>
>> I need to dynamically add new points to the line in real time and show
>> the changes immediately.
>>
>> In the example the positions are already known before creating the line.
>> How can i update this polyline, add new points and show the changes as
>> the line updates?
>>
>> Another thing: If I add more and more points the line will have too much
>> points eventually. Can i filter out not needed points to keep the
>> polydata simple?
>>
>> Regards,
>> Markus
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> 
> 
> 




More information about the vtkusers mailing list