[vtkusers] Changing vtkClipPolyData to ignore processing based on it's Bounding Box evaluation

Seun Odutola seun at rogue-research.com
Fri May 6 16:23:32 EDT 2016


Hi Everyone,
  
      I have a situation where I feed an input (which is an output result of a vtkProbeFilter) to a vtkClipPolyData and subsequently pass it’s output to a vtkPolyDataMapper. Basically my pipeline is as follows 

Mesh(polydata) (M) —> A—> B —> C

A - vtkProbeFilter
B - vtkClipPolyData
C - vtkPolyDataMapper

  I gathered from previous responses to my last message (see topic: How to bypass parts of vtk pipeline) that reconfiguring the pipeline as suggested in that thread was most likely the way to go about achieving that. However, I had an idea which I would like to propose. For instance in my situation as described above my application typically will not be making use of the vtkClipPolyData that often but it’s of utmost importance that I have it configured ready to go whenever the user needs to Clip, so I decided to peek at vtkClipPolyData’s RequestData function where I compare the input’s bounding box (in my case the box to my polydata result from A), if the clippolydata’s box contains M in it’s entirety then I would like the input to be the output of the clippolydata (result going into —> C) but if the clip polydata’s bounding box doesn’t contain M’s bounding box but just intersects it’s points then I would like to clip it and pass along the result to C.
Basically
1 - if B’s box contains M - skip
2 - if B doesn’t contain M but just intersects some of it’s point - then clip.
 I managed to get do the bounds checking that certifies the first part of my algorithm but the 2nd part is the tricky bit when I resize my clipper (in it’s U.I) and then expect the vtkClipPolyData to Clip it empties the entire polydata of M. I believe it has something to do setting the clipScalars. I also noticed the line below in vtkClipPolyData.cxx

for ( i=0; i < numPts; i++ )
{
 	s = this->ClipFunction->FunctionValue(inPts->GetPoint(i));
	tmpScalars->SetComponent(i,0,s);
}

tends to be the bottleneck in my case, which is why I’m trying to find a way to just ignore the effect of B in the pipeline when I need not clip but process it when I need to clip. I understand from the code that when I need to clip the line above must be executed but when I don’t need to clip what could be done to replace this line because ultimately down the line the tmpScalars is set to the clipScalars which is needed for further computation. Thanks everyone


Regards,
   Seun

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160506/a7e59970/attachment.html>


More information about the vtkusers mailing list