[vtkusers] vtkAssembly =>point.set(x, y, z) => refresh normals automaticly ?
vtklearny
msjean at gmx.de
Mon May 11 04:09:09 EDT 2009
Hi vtk know-it-alls,
I'm new to vtk and as the subject tells,
im looking for a way to refresh normals of objects.
I have not found a former post that solved my problem.
Situation:
/////////////////////////////////////////////
I have got a vtkAssembly
and I can access down to the mapper,
so that finaly by:
vtkPolyData* data=mapper->GetInput();
vtkPointData* pdata=(vtkPointData*)(data->GetPointData());
data->GetPoints();
I reach the points of a triangulated mesh.
Then I manipulate certain points:
points->SetPoint(id,newPos);
/////////////////////////////////////////////
Now my QUESTION is , how to perform an update of the normals automaticly
(at best only those which need to be updated).
For now I only see the change of point data in wireframe mode properly.
The code I'm working on tries it like this:
On contruction:
----------------------------------------------------------
vtkPolyDataNormals* normalsFilter;
normalsFilter->SetInput(vtkPolyDataReader->GetOutput());
normalsFilter->ComputeCellNormalsOn();
vtkPolyDataMapper* Mapper = ... ::New();
Mapper->ScalarVisibilityOff();
Mapper->SetInput( normalsFilter->GetOutput() );
//Mapper->SetInputConnection( normalsFilter->GetOutputPort() );
vtkActor* Actor = ... ::New();
Actor->SetMapper( Mapper.GetPointer() );
-----------------------------------------------------------
in MyUpdateFunction():
----------------------------------------------------
vtkPolyDataMapper* polyDataMapper=
getPolyDataMapperFromAssembly(assembly);
vtkAlgorithm* algo= polyDataMapper->GetInputConnection(0,0)->GetProducer();
//algo->Print(cout << "MapperCache::updatePolyDataMapper" << endl);
vtkPolyDataNormals* normals=(vtkPolyDataNormals*)algo;
//normals->Update(); //does not show any change
//algo->Update(); // not even better
//normals->Modified(); //Changes point data back to initial state
-----------------------------------------------------
I hope you can help me with all info I could give.
Thanks a lot for any help.
the vtkLearny
-------------------
Working on: win xp , visual studio, c++, vtk. 5.2.1
--
View this message in context: http://www.nabble.com/vtkAssembly-%3D%3Epoint.set%28x%2Cy%2Cz%29-%3D%3E-refresh-normals-automaticly---tp23445046p23445046.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list