[vtkusers] Filter update does not work.Easy mistake? (samplecode with cell normals)

vtklearny msjean at gmx.de
Tue Jun 16 04:03:19 EDT 2009



daviddoria wrote:
> 
> Your first few lines seem a bit odd to me. I generally update the reader
> before I get it's output:
> 

Your right. That was a copy paste mistake.


daviddoria wrote:
> 
> You can update the points without getting a new instance of the vtkPoints
> or
> "MappedPolyData" pointers, like this (operating directly on the original
> data):
> 
I think I cannot benefit from that, because I would have to much global
references in software that I'm working to.


daviddoria wrote:
>  
> I have removed everything relating to the normals. I'm not sure how you
> are
> expecting to see the normals in this example? Maybe you can be a bit more
> clear on what you expect to see at each step?
> 
I never expected to see normals. But as surfaces are computed by the use of
normals, a change of normal data would be seen on the surfaces. 
In this case, when normal data is not updated, a deformation(bumps and
hills) of the cube is almost not visible, because points of different height
are colored/lighted the exact same way. 
For testing purposes I tried setting the normals to have some surfaces
differently shaded. I did not get that working.
Maybe you know how to do this.


Top goal:
I want to deform the points of my *.vtk object and see a natural result with
surfaces rendered.

In the meantime, I found one way to do it, but that is too slow.


> -------------------------------------------------------
> //getting
>  vtkPolyData* MappedPolyData=Mapper->GetInput();
> 	vtkPoints* points=MappedPolyData->GetPoints(); 
> //movePoints
> for (some points)
>   move point
> 
> //replace mapper's input with normal filter (input might already be a
> normal filter)
> vtkSmartPointer<vtkPolyDataNormals> tmpFilter
> =vtkSmartPointer<vtkPolyDataNormals>::New();
> 		tmpFilter->SetInput(MappedPolyData);
> 		Mapper->SetInput(tmpFilter->GetOutput());
> // now the scene is drawn as expected
> 
> //movePointsAgain
> //replace mapper's input with normal filter
> //again scene is correct
> ------------------------------------------------
> 
Unfortunately this is far too slow.
I would lose all realtime-interactiveness.

There must be a faster way. Like this: 
//load model, 
//install normal filter only once, 
//movepoints, 
//update cells that have been changed OR 
//tell existing normal filter to update whenever points are moved.


I tried not to be confusing.If I'm still not clear , please ask again.

-- 
View this message in context: http://www.nabble.com/Filter-update-does-not-work.Easy-mistake---%28samplecode-with-cell-normals%29-tp23997785p24049491.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list