<div>Look at:</div><div><br></div><div><a href="http://www.vtk.org/doc/nightly/html/classvtkMergePoints.html#3cd8b8f48693148a6b5546c237aab78f">http://www.vtk.org/doc/nightly/html/classvtkMergePoints.html</a></div><div><br>
</div><div>You can insert your points into a merge points class which will determine if the point is a duplicate and return the correct point id.  At the end, you can do:</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">aVoxelGrid-&gt;SetPoints(vMergePts-&gt;GetPoints());</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">- Wes</span></font></div>
<br><div class="gmail_quote">On Tue, Oct 27, 2009 at 11:16 AM, Teresa Azevedo <span dir="ltr">&lt;<a href="mailto:dce06003@fe.up.pt">dce06003@fe.up.pt</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi, Wes. Thank you so much for your quick answer!<br>
<br>
If I try your changes, I runs ok: I get two messages.<br>
But my problem is: I have a set of voxels (with different sizes), from which I build my grid. That is, I do not know which voxels share the same face points.<br>
Is there a way to check, on the point list, if a certain point is already there?<br><font color="#888888">
<br>
Teresa</font><div><div></div><div class="h5"><br>
<br>
Quoting Wes Turner &lt;<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a>&gt;:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Teresa,<br>
<br>
I didn&#39;t try to run this, so there may be more issues than just this one,<br>
but you are duplicating points not sharing them.  Try the changes I marked<br>
below.<br>
<br>
- Wes<br>
<br>
On Tue, Oct 27, 2009 at 10:46 AM, Teresa Azevedo &lt;<a href="mailto:dce06003@fe.up.pt" target="_blank">dce06003@fe.up.pt</a>&gt; wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all.<br>
<br>
I would like to extract the boundary cells of an unstructured grid, that<br>
is, those who have at least one face with no neighbors.<br>
Here is a test code, that builds an unstructured grid, with two voxels that<br>
share one face. When I check if a cell of the grid has neighbors, the code<br>
prompts a message box. Unfortunately, when I run it, I never get the<br>
message.<br>
Can someone tell me what I am doing wrong?<br>
<br>
       vtkUnstructuredGrid* aVoxelGrid = vtkUnstructuredGrid::New();<br>
       aVoxelGrid-&gt;Allocate(2, 2);<br>
<br>
       vtkPoints* vPts = vtkPoints::New();<br>
       vPts-&gt;SetNumberOfPoints(16);<br>
       vPts-&gt;InsertPoint( 0, 0, 0, 0);<br>
       vPts-&gt;InsertPoint( 1, 1, 0, 0);<br>
       vPts-&gt;InsertPoint( 2, 0, 1, 0);<br>
       vPts-&gt;InsertPoint( 3, 1, 1, 0);<br>
       vPts-&gt;InsertPoint( 4, 0, 0, 1);<br>
       vPts-&gt;InsertPoint( 5, 1, 0, 1);<br>
       vPts-&gt;InsertPoint( 6, 0, 1, 1);<br>
       vPts-&gt;InsertPoint( 7, 1, 1, 1);<br>
<br>
       vtkVoxel* vl = vtkVoxel::New();<br>
       vl-&gt;GetPointIds()-&gt;SetId(0, 0);<br>
       vl-&gt;GetPointIds()-&gt;SetId(1, 1);<br>
       vl-&gt;GetPointIds()-&gt;SetId(2, 2);<br>
       vl-&gt;GetPointIds()-&gt;SetId(3, 3);<br>
       vl-&gt;GetPointIds()-&gt;SetId(4, 4);<br>
       vl-&gt;GetPointIds()-&gt;SetId(5, 5);<br>
       vl-&gt;GetPointIds()-&gt;SetId(6, 6);<br>
       vl-&gt;GetPointIds()-&gt;SetId(7, 7);<br>
<br>
       aVoxelGrid-&gt;InsertNextCell(VTK_VOXEL, vl-&gt;GetPointIds());<br>
<br>
       vPts-&gt;InsertPoint( 8, 0, 0, 1);<br>
       vPts-&gt;InsertPoint( 9, 1, 0, 1);<br>
       vPts-&gt;InsertPoint( 10, 0, 1, 1);<br>
       vPts-&gt;InsertPoint( 11, 1, 1, 1);<br>
       vPts-&gt;InsertPoint( 12, 0, 0, 2);<br>
       vPts-&gt;InsertPoint( 13, 1, 0, 2);<br>
       vPts-&gt;InsertPoint( 14, 0, 1, 2);<br>
       vPts-&gt;InsertPoint( 15, 1, 1, 2);<br>
<br>
       vtkVoxel* v2 = vtkVoxel::New();<br>
</blockquote>
<br>
       v2-&gt;GetPointIds()-&gt;SetId(0, 8);<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       v2-&gt;GetPointIds()-&gt;SetId(1, 9);<br>
       v2-&gt;GetPointIds()-&gt;SetId(2, 10);<br>
       v2-&gt;GetPointIds()-&gt;SetId(3, 11);<br>
<br>
</blockquote>
<br>
       v2-&gt;GetPointIds()-&gt;SetId(0, 4);<br>
       v2-&gt;GetPointIds()-&gt;SetId(1, 5);<br>
       v2-&gt;GetPointIds()-&gt;SetId(2, 6);<br>
       v2-&gt;GetPointIds()-&gt;SetId(3, 7);<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       v2-&gt;GetPointIds()-&gt;SetId(4, 12);<br>
       v2-&gt;GetPointIds()-&gt;SetId(5, 13);<br>
       v2-&gt;GetPointIds()-&gt;SetId(6, 14);<br>
       v2-&gt;GetPointIds()-&gt;SetId(7, 15);<br>
<br>
       aVoxelGrid-&gt;InsertNextCell(VTK_VOXEL, v2-&gt;GetPointIds());<br>
       aVoxelGrid-&gt;SetPoints(vPts);<br>
       aVoxelGrid-&gt;Update();<br>
<br>
       vtkGenericCell* cell = vtkGenericCell::New();<br>
       for( int i = 0; i &lt; aVoxelGrid-&gt;GetNumberOfCells(); i++ )<br>
       {<br>
               aVoxelGrid-&gt;GetCell( i, cell );<br>
               vtkIdList* cellNeighbors = vtkIdList::New();<br>
               int numFaces = cell-&gt;GetNumberOfFaces();<br>
               for ( int j = 0; j &lt; numFaces; j++ )<br>
               {<br>
                       vtkCell* face = cell-&gt;GetFace( j );<br>
                       aVoxelGrid-&gt;GetCellNeighbors( i, face-&gt;PointIds,<br>
cellNeighbors);<br>
                       if ( cellNeighbors-&gt;GetNumberOfIds() &gt; 0 )<br>
                       {<br>
                               MessageBox(NULL, &quot;Cell has neighbors!&quot;,<br>
NULL, MB_OK);<br>
                       }<br>
               }<br>
        }<br>
<br>
<br>
Thank you all.<br>
Teresa<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at:<br>
<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote>
<br>
<br>
<br>
--<br>
Wesley D. Turner, Ph.D.<br>
Kitware, Inc.<br>
Technical Leader<br>
28 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: 518-881-4920<br>
<br>
</blockquote>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Wesley D. Turner, Ph.D.<br>Kitware, Inc.<br>Technical Leader<br>28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4920<br>