[vtkusers] Update Polydata in animation

william.nguatem william.nguatem at unibw.de
Fri Nov 29 09:07:51 EST 2013


Below is my code for making a demo. I'll like to be rendering at different
counter values different 3D points stored in the glabal space within an
std::vector. That is, I just want to be updating my scene with different
3DPoints, yes, not only the values but the numbers of points rendered at
each update of counter should be different.
However, in my implementation below, the repeated calls to the
programmableFilter below keeps updating only the values of the 3DPoints but
not the number of points. The example in the VTK/wiki for animating a sphere
works OK since only the values representing a sphere are updated. But I'll
would not work if spheres are represented by different number of points. How
can I get this effect ?



std::vector<vtkSmartPointer&lt;vtkPoints> >all_configurations;
		//purpolate all_configurations
					...
int counter = 0; //updated in the command subclass for the demo effect

void AdjustPoints(void* arguments)
{
	  vtkSmartPointer<vtkProgrammableFilter> programmableFilter = 
      reinterpret_cast<vtkProgrammableFilter*>(arguments);
		
	vtkPolyData* ppoly=programmableFilter->GetPolyDataInput();
	vtkPoints* inPts = ppoly->GetPoints();
	vtkIdType numPts = inPts->GetNumberOfPoints();

	vtkSmartPointer<vtkPoints> newPts = vtkSmartPointer<vtkPoints>::New();
	newPts = all_configurations.at(counter);
	

programmableFilter->GetPolyDataOutput()->CopyStructure(programmableFilter->GetPolyDataInput());
	programmableFilter->GetPolyDataOutput()->SetPoints(newPts);	
}



--
View this message in context: http://vtk.1045678.n5.nabble.com/Update-Polydata-in-animation-tp5724723.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list