[vtkusers] Bug in vtkPolyDataNormals?
danimede
danimede at tiscali.it
Fri Dec 21 04:08:40 EST 2012
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 <
> danimede@
> > 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.
More information about the vtkusers
mailing list