[vtk-developers] Generic method for getting a sub-cell
David Gobbi
david.gobbi at gmail.com
Fri Apr 2 10:33:03 EDT 2010
Speaking of subcells, I've identified a problem with the way that
IntersectWithLine is implemented in vtkTriangleStrip et al. The
way IntersectWithLine is implemented in these classes is:
for triangle in strip:
if triangle->IntersectWithLine(tol)
return
In other words, the loop alway stops at first hit, but due to
tolerance there might be more than one potential hit. It
could, instead, look for all potential hits and then use
ParametricDistance() as a tiebreaker.
- David
On Thu, Apr 1, 2010 at 2:38 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi Will,
>
> Yes, all the efficient (npts, pts) API styles would also have to be
> supported. Ideally every GetCell method signature would need an
> equivalent GetSubCell method. The following classes would need to be
> changed:
>
> vtkDataSet
> vtkCell (the base class)
> vtkGenericCell
> vtkTriangleStrip et all
>
> You are correct that most of the cell classes would be unaffected.
> Only vtkTriangleStrip and similar classes would have to be modified.
>
> David
>
>
> On Thu, Apr 1, 2010 at 2:17 PM, Will Schroeder
> <will.schroeder at kitware.com> wrote:
>> David in the long term I don't see why we couldn't easily add
>> something like this to both the cell and dataset APIs. To minimize the
>> initial effort (i.e., so you don't have to do it to all the datasets)
>> I'd initially just add it to the affected cell types (e.g., triangle
>> strip, polyline, polyvert, etc.) Also, if I understand correctly you
>> are returning a new cell (or a pointer to an internal cell instance),
>> have you looked at alternative APIs to return the information faster,
>> and more compactly? I'm thinking of something akin to
>> vtkCellArray::GetNextCell(npts,pts)...just curious.
>>
>>
>> On Thu, Apr 1, 2010 at 1:40 PM, David Gobbi <david.gobbi at gmail.com> wrote:
>>> Hi All,
>>>
>>> Would it be possible to add a generic method for getting a sub-cell from a cell?
>>>
>>> vtkCell *cell->GetSubCell(int subId);
>>> void cell->GetSubCell(int subId, vtkGenericCell *subCell);
>>>
>>> Even better would be an easy way of iterating through the sub-cells in
>>> a vtkDataSet directly:
>>>
>>> data->GetNumberOfSubCells(vtkIdType cellId);
>>> data->GetSubCell(vtkIdType cellId, int subId, vtkGenericCell *subCell);
>>>
>>> There are several times when I've had to add special cases to my code
>>> to handle triangle strips, and if there was a generic method for
>>> getting sub-cells, my code could be a lot simpler.
>>>
>>> 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
>>>
>>>
>>
>>
>>
>> --
>> William J. Schroeder, PhD
>> Kitware, Inc.
>> 28 Corporate Drive
>> Clifton Park, NY 12065
>> will.schroeder at kitware.com
>> http://www.kitware.com
>> (518) 881-4902
>>
>
More information about the vtk-developers
mailing list