Question / Issue with vtkPolyLine::GenerateSlidingNormals
This question came up while implementing the tube filter for VTKm. I used the VTK code to guide my implementation. During the code review, @kmorel had a question on the code that comes from the implementation in vtkPolyLine::GenerateSlidingNormals
Common/DataModel/vtkPolyLine.cxx
w is set to sPrev X normal. If the length of w is zero, it will continue. However, nothing in the while loop between lines 174 and 185 will change the value of sPrev or normal, and so w will continue to be zero.
vtkIdType lastNormalId = 0;
while (++sNextId < npts)
{
sNextId = FindNextValidSegment(pts, linePts, sNextId);
if (sNextId == npts)
{
break;
}
vtkVector3d pt1, pt2;
pts->GetPoint(linePts->GetId(sNextId), pt1.GetData());
pts->GetPoint(linePts->GetId(sNextId + 1), pt2.GetData());
sNext = (pt2- pt1).Normalized();
//compute rotation vector
vtkVector3d w = sPrev.Cross(normal);
if (w.Normalize() == 0.0) // can't use this segment
{
continue;
}
.....
Further, w is not used again (the variable is overwritten later in the while loop with another cross product), so the purpose of w is unclear. Thoughts?
Edited by Dave Pugmire