I've just been fighting with a small piece of code based around some calls to vtkPoints's GetPoint method.<br><br>The code:<br><br clear="all"><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp; double *p1, *p2;<br>&nbsp;&nbsp;&nbsp; for(i=0; i&lt;newPts-&gt;GetNumberOfPoints()-1; i++) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p1=newPts-&gt;GetPoint(i);
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(j=i+1; j&lt;newPts-&gt;GetNumberOfPoints(); j++) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p2=newPts-&gt;GetPoint(j);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // compute distance from p1 to p2<br style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">
</span><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; }<br><br style="font-family: courier new,monospace;">
</span></div>Seems like this should work just fine, but p1 changes when I request p2.&nbsp; It seems that the 2 calls return the exact same pointer address in memory, so previous calls change with new ones.&nbsp; Simply switching to this:
<br><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; double p1[3], p2[3];<br>
&nbsp;&nbsp;&nbsp; for(i=0; i&lt;newPts-&gt;GetNumberOfPoints()-1; i++) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newPts-&gt;GetPoint(i, p1);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(j=i+1; j&lt;newPts-&gt;GetNumberOfPoints(); j++) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newPts-&gt;GetPoint(j, p2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // compute distance from p1 to p2<br style="font-family: courier new,monospace;">
</span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; }<br>
</span>Works just fine.&nbsp; With a bit of research I see that vtkPoints is just a wrapper around a vtkFloatArray, which uses an internal pointer array named &quot;Tuple&quot; to do this.&nbsp; It's listed as not &quot;Thread Safe&quot;, but it seems it's far more than that.. It's basically Volatile, with the value changing at any time.&nbsp; Is this by-design or is this a bug?
<br>-- <br>----------------------------------------<br>Randall Hand<br>Visualization Scientist<br>ERDC MSRC-ITL