<div dir="ltr">Hello,<div><br></div><div>I am trying to figure out how to select the closest neighboring points to a list of coordinates using the vtk library. I have a simple point data set in the Unstructured Grid Format. The dataset contains one attribute named the 'point_id' which is just enumerating the points starting from 1 instead of 0. The raw text from the ASCII file is attached in testScalar.vtk below.</div><div><br></div><div>I have also written a script in python which I thought would function as follows:</div><div><br></div><div>INPUT: </div><div><ol><li>List of tuples containing world coordinates [(X1,Y1,Z1),(X2,Y2,Z2)]<br></li><li>name of attribute to extract as a string. in this case "point_id"</li></ol><div>OUTPUT:</div></div><div><ol><li>List of floating point values of the attribute for the selected points</li></ol><div>This does work to a certain degree, for instance when I do :</div></div><div><br></div><div>ExtractByLocation('testScalar.vtk', [(5.999,0,0)], 'point_id')</div><div><br></div><div>I do indeed get back the following:</div><div><br></div><div>array([ 2.], dtype=float32)<br></div><div><br></div><div>So point_id 2 is the closest point to the coordinates I have specified. However, as soon as I get a bit too far from one of the points, the function starts returning an empty list. For instance:</div><div><br></div><div>ExtractByLocation('testScalar.vtk', [(5.888,0,0)], 'point_id')<br></div><div><br></div><div>Returns </div><div>array([], dtype=float32)<br></div><div><br></div><div>I found out that the cut off point is 5.89-5.90. If I plugin 5.9 I get the point, if I plugin 5.89 I get back an empty list.</div><div><br></div><div>According to the object reference (<a href="https://www.vtk.org/doc/nightly/html/classvtkSelectionNode.html#aa7b54148c40adf4f5019b8ad3e160535a97d8505c922b2a25c5d2755607d3cbb6">https://www.vtk.org/doc/nightly/html/classvtkSelectionNode.html#aa7b54148c40adf4f5019b8ad3e160535a97d8505c922b2a25c5d2755607d3cbb6</a>)</div><div> LOCATIONS is supposed to select the points near the supplied world coordinates. Is there an option or something that selects the nearest point PERIOD? i.e using a simple distance formula? I would like to never get back an empty list but always get back a list of the closest point to the supplied coordinates.</div><div><br></div><div>Kind Regards,</div><div><br></div><div>Amine </div><div><br></div></div>