[vtkusers] no neighbors by using GetCellNeighbors with OBJ-files
David Doria
daviddoria at gmail.com
Wed May 21 11:40:55 EDT 2014
On Wed, May 21, 2014 at 11:32 AM, -Daniel- <ich_daniel at habmalnefrage.de>wrote:
> Hi there,
>
> I use GetCellNeighbors() method for 3D objects.
> It works fine with STL-files, but when I use OBJ-files I get no cell
> neighbors.
> Is there a solution?
>
> My code-snippet:/
> for (int i = 0; i < cellPointIds.GetNumberOfIds(); i++) {
> vtkIdList idList = new vtkIdList();
> idList.InsertNextId(cellPointIds.GetId(i));
>
> vtkIdList neighborCellIds = new vtkIdList();
>
> polydata.GetCellNeighbors(cellId, idList, neighborCellIds);
>
> for (int j = 0; j < neighborCellIds.GetNumberOfIds(); j++) {
> neighbors.add(neighborCellIds.GetId(j));
> }
>
> // -> no neighbors by using OBJ
> System.out.println(" neighbors: "+neighborCellIds.GetNumberOfIds());
>
> idList.Delete();
> neighborCellIds.Delete();
> }
> /
>
> Can anybody help me? Whats wrong here?
>
Daniel,
After using an STL reader or an OBJ reader, you now have a vtkPolyData
object. If the neighbors don't work with one or the other, something must
have gone wrong/not as expected with either the reading or writing of your
STL or OBJ files. I'd suggest opening the files in Paraview to see if all
of the data you are expecting is there.
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140521/42419d6e/attachment.html>
More information about the vtkusers
mailing list