[vtkusers] vtkMaskPoints bug

Joey Mukherjee joey at phobos.space.swri.edu
Mon Aug 5 13:42:56 EDT 2002


I noticed that vtkMaskPoints has a bug in that if you SetMaximumNumberOfPoints 
to 1, nothing will be plotted.  Digging in the code, I see:

    for ( ptId = this->Offset;
    (ptId < numPts) && (id < (this->MaximumNumberOfPoints-1)) && !abort;
    ptId += this->OnRatio )

The part that fails is "id < (this->MaximumNumberOfPoints-1)" since id is 0 and 
this->MaximumNumberOfPoints-1 is zero, it never falls in the loop.  Changing it 
to a <= doesn't work for values > 1.  I added a :

    if (this->MaximumNumberOfPoints == 1) {
      x =  input->GetPoint(this->Offset);
      id = newPts->InsertNextPoint(x);
      outputPD->CopyData(pd,this->Offset,id);
    } else

above it, but this may not be the best fix since there may be a way to handle 
the random case and the non-random case in the same way.

If you need a test case, the Examples/VisualizationAlgorithms/Tcl/spikeF.tcl 
exhibits the problem if you add a ptMask SetMaximumNumberOfPoints 1 in there.

Cheers,
Joey

+--------------------------------------------------------------------------+
+                                                                          +
+     Joey Mukherjee                 "The price of freedom is eternal      +
+     joey at swri.org                   vigilance, or $12.50 as seen on      +
+                                     eBay...                              +
+                                                                          +
+--------------------------------------------------------------------------+





More information about the vtkusers mailing list