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

王君臣 wangjunchen at gmail.com
Thu Apr 2 07:47:12 EDT 2009


2009/4/2 Konstantinos Kelg <kkelgeor at yahoo.gr>

>
> 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 ?

                               ~~~~~~~yourData is the polydata whose vertex
normal is to be calculated, and the ouput of the vtkPolyDataNormals is the
polydata that contains the normals, you can check the instance of the
vtkPointData or vtkCellData to retrieve the normals

>
> 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
>
>
> _______________________________________________
> 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
>



-- 
王君臣
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090402/af7b0cf3/attachment.htm>


More information about the vtkusers mailing list