<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Can you share data with an example to demonstrate the issue?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 6, 2019 at 10:00 AM Patrick Bergeron <<a href="mailto:pbergeron@spiria.com">pbergeron@spiria.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div id="gmail-m_3701525296146871235divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0px;margin-bottom:0px">Hi folks.</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">Does the below ring a bell to anyone?</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">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.</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt">Basically my application loads a triangle mesh, and I use the mouse to pick the
</span><span style="font-size:12pt">cell and nearest point ID, and I will put a marker on the nearest point ID.</span><br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt">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.</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt">- I have verified the number of points that I put in my PolyData's vtkPoints array has the correct count.</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt">- I have verified that I never create any triangle with invalid point IDs.</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt">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.</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt">When tracing into vtk, I notice these symptoms when I reach  </span><span style="font-size:12pt"><b>vtkCellPicker::IntersectActorWithLine()</b></span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"><br>
</span></p>
<p style="margin-top:0px;margin-bottom:0px">One of the first thing this method does is to call </p>
<p style="margin-top:0px;margin-bottom:0px"></p>
<div><b>this->IntersectDataSetWithLine(data, p1, p2, t1, t2, tol, <span style="font-size:12pt">locator</span><span style="font-size:12pt">, minCellId, minSubId, </span><span style="font-size:12pt">tMin</span><span style="font-size:12pt">, pDistMin,
 minXYZ, minPCoords);</span></b></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div>(and I get a minCellId that mighbe suspicious? not sure at this point)</div>
<div><br>
</div>
<div>Later:</div>
<div><br>
</div>
<div>
<div>if (minCellId >= 0 && tMin < this->GlobalTMin)</div>
<div>{</div>
</div>
<div>     ...</div>
<div>
<div>        data->GetCell(minCellId, cell);</div>
<div><span style="font-size:12pt">}</span><br>
</div>
</div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">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.</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">And then of course, later:</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">
<div>if (iMaxWeight != -1)</div>
<div>{</div>
<div>    this->PointId = cell->PointIds->GetId(iMaxWeight);   // <---- PointId is out of range.</div>
<div>}</div>
<div><br>
</div>
</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">How could this be? Any clues? Rings a bell?</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div>Thanks</div>
<div>Patrick Bergeron</div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><br>
</div>
<div id="gmail-m_3701525296146871235Signature">
<div id="gmail-m_3701525296146871235divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p></p>
</div>
</div>
</div>
</div>

_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>William J. Schroeder, PhD<br>Kitware, Inc. - Building the World's Technical Computing Software<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a><br><a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a><br>(518) 881-4902</div></div></div>