[vtkusers] Bug in vtkPolyDataNormals?

Alex Malyushytskyy alexmalvtk at gmail.com
Thu Dec 20 16:45:58 EST 2012


AFAS I understand Normal length must not be 0.
If it is 0 it can be any, cause it means unexpected problem in the code.
I would probably set it to the OX. But your suggestion is worse than current,
cause it may break other code which expects a well defined vector as a normal.

Alex

On Thu, Dec 20, 2012 at 8:45 AM, danimede <danimede at tiscali.it> wrote:
> Hi All,
>
> I have found a weird computation in vtkPolyDataNormals.cpp. The issue is in
> the follow piece of code:
>
> for (i=0; i < numNewPts; i++) {
>       newNormals->GetTuple(i, vertNormal);
>       length = vtkMath::Norm(vertNormal);
>       if (length != 0.0) {
>           for (j=0; j < 3; j++) {
>               n[j] = vertNormal[j] / length * flipDirection;
>           }
>       }
>       newNormals->SetTuple(i,n);
> }
>
> In the code if we have a length equal to zero we set in the i-th tuple the
> normal values of the (i-th)-1 point!
> Is it a bug or maybe there are some hypothesis like consecutive index points
> can have the same normal vector?
> Probably the solution is to set the normal to {0.0 , 0.0 , 0.0} if we have a
> length equal to zero.
>
> Regards,
> Daniele
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Bug-in-vtkPolyDataNormals-tp5717683.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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



More information about the vtkusers mailing list