[vtk-developers] Bug with vtkCellLocator and VTK_VERTEX cells

David Thompson david.thompson at kitware.com
Wed Aug 28 11:22:00 EDT 2013


Hi John,

> You might want to try
>  18 // .NAME vtkParticleBoxTree - Special BSP tree for particles with no size
> I need to change this to use vtkCellTreeLocator as a base class to save memory as the ModifiedBSPTree uses way too much and it's mostly redundant in this case anyway.

Thanks, I will give it a try. The per-cell radius might actually be useful for my application.

All: Regardless of whether that works, it seems like we should do something to vtkCellLocator -- at least to document that vertex picking won't work.

	David

>> -----Original Message-----
>> From: vtk-developers-bounces at vtk.org [mailto:vtk-developers-
>> bounces at vtk.org] On Behalf Of David Thompson
>> Sent: 27 August 2013 21:17
>> To: VTK Developers
>> Subject: [vtk-developers] Bug with vtkCellLocator and VTK_VERTEX cells
>> 
>> Hi all,
>> 
>> I've run into some trouble in vtkCellLocator's implementation of
>> IntersectWithLine() when running on a dataset composed almost entirely of
>> VTK_VERTEX cells. The problem appears to be an overly-aggressive
>> optimization. Around line 284 of vtkCellLocator.cxx, each cell in an octant of
>> the locator has its bounds intersected with the test ray *without a tolerance*
>> before the cell is extracted and its IntersectWithLine() method is called. This
>> is a problem since VTK_VERTEX bounds are degenerate and very unlikely to
>> intersect the test line.
>> 
>> There are several possible fixes:
>> 
>> 1. Don't do that (call IntersectWithLine on point clouds). If we aren't
>> supposed to use the cell locator with vertex cells, should we add an
>> IntersectWithLine method to vtkPointLocator?
>> 
>> 2. Avoid using vtkCell. We could use static geometric helpers for certain
>> simple cell types like points and triangles, bypassing the whole bounding box
>> and vtkCell::IntersectWithLine() tests.
>> 
>> 3. Fix the optimization.
>> 
>>  a. We can always just tweaking the bounding boxes by the tolerance before
>> running the intersection test. This works for me but I didn't do the same for
>> the CacheCellBounds case which is tricky since a different tolerance might be
>> used for successive queries and copying the bounds eliminates some benefit
>> of caching them.
>> 
>>  b. Add a method to test box-line intersection that takes a tolerance.
>> 
>> Any ideas on which fix is the best? Is there some better way to pick 3-D
>> points from a 2-D rendering than firing a ray with
>> vtkCellLocator::IntersectWithLine?
>> 
>> 	Thanks,
>> 	David
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
> 




More information about the vtk-developers mailing list