[vtkusers] How to set the normals for a surface ?

Konstantinos Kelg kkelgeor at yahoo.gr
Thu Apr 2 07:41:29 EDT 2009


Hello,


I need to set the normals of a surface.
I have 1 normal for each vertex of the mesh.
I try this but I get a crash:


vtkFloatArray* arr = vtkFloatArray::New();
arr->SetNumberOfComponents(3);
arr->SetArray((float*)NormP, m_NumOfVertices, 0);
polyData->GetCellData()->SetNormals(arr);
arr->Delete();


I found this piece of code on the web but it's not complete:

vtkPolyDataNormals *normals = vtkPolyDataNormals::New();
normals->SetInput(yourData); // Is "yourData" the normals per vertex ?
normals->ComputeCellNormalsOn();
normals->ComputePointNormalsOff();
normals->Update();

Does anyone know which is the way to do this and how do I actually set the vtkPolyDataNormals if I should follow the 2nd way ?

Thanks.




      
___________________________________________________________ 
Χρησιμοποιείτε Yahoo!; 
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail 
διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών 
μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr 





More information about the vtkusers mailing list