[vtk-developers] Bad Point IDs being picked with vtkCellPicker?

Patrick Bergeron pbergeron at spiria.com
Wed Feb 6 10:00:46 EST 2019


Hi folks.


Does the below ring a bell to anyone?


I am running an older version of VTK that I forked some time last summer (june or july or so), and vtkCellPicker behaves oddly sometimes.


Basically my application loads a triangle mesh, and I use the mouse to pick the cell and nearest point ID, and I will put a marker on the nearest point ID.


This works 99% of the time. But, in some rare circumstances, the cell I pick returns a point ID that is out of range, eg, larger than the number of points in my triangle mesh.


- I have verified the number of points that I put in my PolyData's vtkPoints array has the correct count.

- I have verified that I never create any triangle with invalid point IDs.


Yet, when I pick certain cells, the picked Point ID is incorrect. For example, if I have 49,229 points, the picked cell will say the nearest point ID is 56,223, which is impossible, given that m_PolyData->GetPoints()->GetNumberOfPoints() returns 49,229.


When tracing into vtk, I notice these symptoms when I reach  vtkCellPicker::IntersectActorWithLine()


One of the first thing this method does is to call

this->IntersectDataSetWithLine(data, p1, p2, t1, t2, tol, locator, minCellId, minSubId, tMin, pDistMin, minXYZ, minPCoords);

(and I get a minCellId that mighbe suspicious? not sure at this point)

Later:

if (minCellId >= 0 && tMin < this->GlobalTMin)
{
     ...
        data->GetCell(minCellId, cell);
}

If I look at this cell, and its point IDs, I see that 2 out of 3 point IDs is larger than my total point count for my mesh.

And then of course, later:

if (iMaxWeight != -1)
{
    this->PointId = cell->PointIds->GetId(iMaxWeight);   // <---- PointId is out of range.
}


How could this be? Any clues? Rings a bell?

Thanks
Patrick Bergeron


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtk-developers/attachments/20190206/3ec722f6/attachment.html>


More information about the vtk-developers mailing list