Bad Point IDs being picked with vtkCellPicker?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bad Point IDs being picked with vtkCellPicker?

drjustice

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



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: Bad Point IDs being picked with vtkCellPicker?

VTK - Dev mailing list
Can you share data with an example to demonstrate the issue?

On Wed, Feb 6, 2019 at 10:00 AM Patrick Bergeron <[hidden email]> wrote:

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


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtk-developers



--
William J. Schroeder, PhD
Kitware, Inc. - Building the World's Technical Computing Software
28 Corporate Drive
Clifton Park, NY 12065
[hidden email]
http://www.kitware.com
(518) 881-4902

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtk-developers