[vtkusers] Bug in vtkPolyDataNormals?

Alex Malyushytskyy alexmalvtk at gmail.com
Fri Dec 21 20:34:40 EST 2012


Condition 'if' you refer to is inside the private code which prevents
of invalid normal to be exposed to public.

If you want to visualize two polygons  each has its own normal which
are completely independent.
If you want them to be displayed properly you should see light
conditions defined by the normal directed towards you.

By the way you can always try to provide a patch and see if it is accepted.

Regards,
   Alex


On Fri, Dec 21, 2012 at 1:08 AM, danimede <danimede at tiscali.it> wrote:
> Hi Alex,
>
> if Normal length must not be 0, the IF condition is useless, or not?
> And if I have two polygons that represent the same one, i.e. A-B-C (first
> triangular polygon) and A-C-B, when I compute the normal for point A is
> correct to have a normal vector equal to 0.0, due to the two polygonal
> normals are the same vector but with opposite sign. Maybe a check in the
> initial stage can be helpful to avoid this scenario.
>
> Regards,
> Daniele
>
>
>
> Alex Malyushytskyy wrote
>> 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 &lt;
>
>> danimede@
>
>> &gt; 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-tp5717683p5717690.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