<div dir="ltr">Hi,<div>I am constructing polydata for unstructured grid from randomly scattered points.</div><div><br></div><div>Once I know the point IDs I am creating the connectivity between two points using a line (vtkline) and creating the cells around</div><div><br></div><div>Something like this example : <a href="http://www.vtk.org/Wiki/VTK/Tutorials/TriangleGeometryLines">http://www.vtk.org/Wiki/VTK/Tutorials/TriangleGeometryLines</a></div><div><br></div><div>The connectivity works this way</div><div><pre class="de1" style="font-family:monospace,monospace;padding:0px;border:0px none white;color:rgb(0,0,0);line-height:1.2em;font-stretch:normal;font-size:1em;margin-top:0px;margin-bottom:0px;vertical-align:top;background:none rgb(249,249,249)"><span class="co1" style="color:rgb(102,102,102)">//create a line between each pair of points</span>
vtkSmartPointer<span class="sy1" style="color:rgb(0,0,128)"><</span>vtkLine<span class="sy1" style="color:rgb(0,0,128)">></span> line0 <span class="sy1" style="color:rgb(0,0,128)">=</span> vtkSmartPointer<span class="sy1" style="color:rgb(0,0,128)"><</span>vtkLine<span class="sy1" style="color:rgb(0,0,128)">></span><span class="sy4" style="color:rgb(0,128,128)">::</span><span class="me2" style="color:rgb(0,119,136)">New</span><span class="br0" style="color:rgb(0,128,0)">(</span><span class="br0" style="color:rgb(0,128,0)">)</span><span class="sy4" style="color:rgb(0,128,128)">;</span>
line0<span class="sy2" style="color:rgb(0,0,64)">-</span><span class="sy1" style="color:rgb(0,0,128)">></span>GetPointIds<span class="br0" style="color:rgb(0,128,0)">(</span><span class="br0" style="color:rgb(0,128,0)">)</span><span class="sy2" style="color:rgb(0,0,64)">-</span><span class="sy1" style="color:rgb(0,0,128)">></span>SetId <span class="br0" style="color:rgb(0,128,0)">(</span> <span class="nu0" style="color:rgb(0,0,221)">0</span>,<span class="nu0" style="color:rgb(0,0,221)">0</span> <span class="br0" style="color:rgb(0,128,0)">)</span><span class="sy4" style="color:rgb(0,128,128)">;</span>
line0<span class="sy2" style="color:rgb(0,0,64)">-</span><span class="sy1" style="color:rgb(0,0,128)">></span>GetPointIds<span class="br0" style="color:rgb(0,128,0)">(</span><span class="br0" style="color:rgb(0,128,0)">)</span><span class="sy2" style="color:rgb(0,0,64)">-</span><span class="sy1" style="color:rgb(0,0,128)">></span>SetId <span class="br0" style="color:rgb(0,128,0)">(</span> <span class="nu0" style="color:rgb(0,0,221)">1</span>,<span class="nu0" style="color:rgb(0,0,221)">1</span> <span class="br0" style="color:rgb(0,128,0)">)</span><span class="sy4" style="color:rgb(0,128,128)">;</span></pre><pre class="de1" style="font-family:monospace,monospace;padding:0px;border:0px none white;color:rgb(0,0,0);line-height:1.2em;font-stretch:normal;font-size:1em;margin-top:0px;margin-bottom:0px;vertical-align:top;background:none rgb(249,249,249)"><span class="sy4" style="color:rgb(0,128,128)"><br></span></pre>The way I am doing it is to find nearest neighbours for each point and setting a line between those two points. In this, I am overdoing the creation of lines because when I search nearest neighbour for point I (say Id = 8) and find J (say Id = 10), I create a line between 8 and 10.</div><div><br></div><div>The next time, I found the point I (Id = 10) for which one of the nearest neighbour is Id=8. At this stage I don't want to create a connectivity between 10 and 8 again, since I have already created it for 8-10.</div><div><br></div><div>Any idea how to I do that.</div><div><br></div><div>vtkCleanPolydata filter takes care of the duplicate points but not for duplicate lines (cells). Is there any classes/ filter available which I can use?</div><div><br></div><div>Thanks much in advance.</div><div><br></div><div>Chiranjib</div><div><br></div></div>