<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi folks.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Does the below ring a bell to anyone?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">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:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><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:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><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:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><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:0;margin-bottom:0"><span style="font-size: 12pt;">- I have verified that I never create any triangle with invalid point IDs.</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><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:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0"><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:0;margin-bottom:0"><span style="font-size: 12pt;"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0">One of the first thing this method does is to call </p>
<p style="margin-top:0;margin-bottom:0"></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="Signature">
<div id="divtagdefaultwrapper" 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>
</body>
</html>