<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi James,<br>
Without getting into too much detail, there is a bug in vtkPointLocator
which can potentially access a negative index into the Hashtable array
(buckets) if there are points in the dataset which fall outside the
bounds of the dataset.&nbsp; I have been so busy that I haven't submitted a
patch, but you can try this if you can't wait.<br>
<br>
vtkPointLocator.cxx::BuildLocator() should look something like this
(add the stuff in bold italics)<br>
<br>
...<br>
&nbsp;&nbsp;&nbsp; idx = ijk[0] + ijk[1]*ndivs[0] + ijk[2]*product;<br>
<b><i>&nbsp;&nbsp;&nbsp; if (idx &gt; -1) <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { // make sure valid bucket id, negative if point outside<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // dataset bounds...</i></b><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bucket = this-&gt;HashTable[idx];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( ! bucket )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bucket = vtkIdList::New();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bucket-&gt;Allocate(this-&gt;NumberOfPointsPerBucket,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;NumberOfPointsPerBucket/3);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;HashTable[idx] = bucket;<br>
<b><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</i></b><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bucket-&gt;InsertNextId(i);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
<br>
...<br>
<br>
James C Robinson wrote:
<blockquote
 cite="mid200508161658.j7GGw94v002931@smtp-prs03.proxy.aol.com"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 11 (filtered medium)">
  <o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"
 downloadurl="http://www.5iamas-microsoft-com:office:smarttags">
  <o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"
 downloadurl="http://www.5iantlavalamp.com/"><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName">
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
  <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Wingdings 2";
        panose-1:5 2 1 2 1 5 7 7 7 7;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
  </style></o:SmartTagType></o:SmartTagType></o:SmartTagType>
  <div class="Section1">
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Dear All,<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I have a set of flow
vectors associated with the points of
an unstructured grid. I use the following to create a stream tube:<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 72pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;pStreamLine-&gt;SetInput(pUnstructuredGrid)
;&nbsp;&nbsp; // vtkStreamTracer<o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 72pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;pStreamTube-&gt;SetInput(pStreamLine-&gt;GetOutput())
; // vtkTubeFilter<o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 72pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;pStreamMapper-&gt;SetInput(pStreamTube-&gt;GetOutput())
; // vtkPolyDataMapper<o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 72pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;pStreamActor-&gt;SetMapper(pStreamMapper);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;// vtkActor<o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 36pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">At any given time I wish
to find the closest point in the stream
tube (say the closest point in the underlying polyline of the stream
tracer) to
the camera (in order to keep the radius of the stream tube fairly
constant on the
screen). To this end I do the following:<o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 36pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 36pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkDataSet*
pDataSet = (vtkDataSet*)((pStreamLine-&gt;GetOutput())-&gt;GetPoints())
;<o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 36pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pClosestStreamPointLocator-&gt;SetDataSet(pDataSet)
;&nbsp; // vtkPointLocator<o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 36pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pClosestStreamPointLocator-&gt;AutomaticOn()
;<o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 36pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pClosestStreamPointLocator-&gt;BuildLocator()
;<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I then use <o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 36pt;"><font face="Arial"
 size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
pClosestStreamPointLocator-&gt;BuildLocator()
; // In case the stream tube has changed since the locator was last
updated.<o:p></o:p></span></font></p>
  <p class="MsoNormal" style="margin-left: 36pt; text-indent: 36pt;"><font
 face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">pClosestStreamPointLocator-&gt;FindClosestPoint(camPos)
; // Where camPos is a float[3] array.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">when I wish to find the
closest point. However, it causes a
crash. I am obviously doing something pretty simple wrong. Please
advise&#8230;&#8230;.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Jim<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"><o:p>&nbsp;</o:p></span></font></p>
  <div>
  <p class="MsoNormal"><b><font color="navy" face="Arial" size="3"><span
 style="font-size: 12pt; font-family: Arial; color: navy; font-weight: bold;">James
C
Robinson</span></font></b><b><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy; font-weight: bold;">,
  </span></font><font color="navy"><span style="color: navy;"><o:p></o:p></span></font></b></p>
  <p class="MsoNormal"><b><font color="navy" face="Wingdings" size="3"><span
 style="font-size: 12pt; font-family: Wingdings; color: navy; font-weight: bold;">+</span></font></b><b><font
 color="navy"><span style="color: navy; font-weight: bold;" lang="FR">&nbsp;&nbsp;&nbsp;&nbsp;42
Rivergrove</span></font></b><b><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy; font-weight: bold;"
 lang="FR">,</span></font></b><b><font color="navy"><span
 style="color: navy; font-weight: bold;" lang="FR"><o:p></o:p></span></font></b></p>
  <p class="MsoNormal"><b><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy; font-weight: bold;"
 lang="FR">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </span></font></b><b><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; font-weight: bold;"><ns0:City
 w:insauthor="Jim" w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><ns0:place w:insauthor="Jim"
 w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><ns0:City w:insauthor="Jim"
 w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><ns0:place w:insauthor="Jim"
 w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><font color="navy"><span
 style="color: navy;" lang="FR">Glanmire</span></font></ns0:place></ns0:City></ns0:place></ns0:City></span></font></b><b><font
 color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy; font-weight: bold;"
 lang="FR">,</span></font></b><b><font color="navy"><span
 style="color: navy; font-weight: bold;" lang="FR"><o:p></o:p></span></font></b></p>
  <p class="MsoNormal"><b><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy; font-weight: bold;"
 lang="FR">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </span></font></b><b><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy; font-weight: bold;">Co.
  </span></font></b><b><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; font-weight: bold;"><ns0:City
 w:insauthor="Jim" w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><ns0:place w:insauthor="Jim"
 w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><ns0:City w:insauthor="Jim"
 w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><ns0:place w:insauthor="Jim"
 w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><st1:City w:st="on"><st1:place
 w:st="on"><font color="navy"><span style="color: navy;">Cork</span></font></st1:place></st1:City></ns0:place></ns0:City></ns0:place></ns0:City><font
 color="navy"><span style="color: navy;">,</span></font></span></font><font
 color="navy"><span style="color: navy;"><o:p></o:p></span></font></b></p>
  <p class="MsoNormal"><b><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy; font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </span></font></b><b><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; font-weight: bold;"><ns0:place
 w:insauthor="Jim" w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><ns0:place w:insauthor="Jim"
 w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><st1:place w:st="on"><font
 color="navy"><span style="color: navy;">Eire</span></font></st1:place></ns0:place></ns0:place></span></font><font
 color="navy"><span style="color: navy;"><o:p></o:p></span></font></b></p>
  <p class="MsoNormal"><b><font color="navy" face="Wingdings 2" size="3"><span
 style="font-size: 12pt; font-family: &quot;Wingdings 2&quot;; color: navy; font-weight: bold;">'</span></font></b><b><font
 color="navy" face="Arial"><span
 style="font-family: Arial; color: navy; font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp; +353
21&nbsp;4822028</span></font><font color="navy"><span style="color: navy;"><o:p></o:p></span></font></b></p>
  <p class="MsoNormal"><b><font color="navy" face="Times New Roman"
 size="3"><span style="font-size: 12pt; color: navy; font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+353 87 2393010<o:p></o:p></span></font></b></p>
  <p class="MsoNormal"><b><font color="navy" face="Wingdings" size="3"><span
 style="font-size: 12pt; font-family: Wingdings; color: navy; font-weight: bold;">-</span></font></b><b><font
 color="navy" face="Arial"><span
 style="font-family: Arial; color: navy; font-weight: bold;">&nbsp;&nbsp;&nbsp; </span></font><ns0:PersonName
 w:insauthor="Jim" w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"><ns0:PersonName w:insauthor="Jim"
 w:insdate="2005-08-16T17:49:00Z" w:endinsauthor="Jim"
 w:endinsdate="2005-08-16T17:49:00Z"></ns0:PersonName><font color="blue"><span
 style="color: blue;"><a href="mailto:jrobinson@eircom.net">jrobinson@eircom.net<font
 color="black"><span style="color: windowtext; text-decoration: none;"></span></font></a></span></font></ns0:PersonName><font
 color="blue"><a href="mailto:jrobinson@eircom.net"><font color="black"><span
 style="color: windowtext; text-decoration: none;">&gt;</span></font></a></font><font
 color="navy" face="Arial"><span
 style="font-family: Arial; color: navy;">&nbsp;</span></font><font
 color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy; font-weight: normal;"><o:p></o:p></span></font></b></p>
  <p class="MsoNormal"><font face="Times New Roman" size="3"><span
 style="font-size: 12pt;"><o:p>&nbsp;</o:p></span></font></p>
  </div>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
Jeff Lee
Senior Software Engineer
Computational Dynamics North America Ltd
21 Lafayette Street, Suite 230
Lebanon NH 03766 USA
fax:   603 643 9994
phone: 603 643 9993 x109
<a class="moz-txt-link-freetext" href="http://www.cd-adapco.com">http://www.cd-adapco.com</a>
</pre>
</body>
</html>