[vtkusers] How to get neighbors with vtkCellLinks ?
Lloyd Fenelon
lfenelon at bccrc.ca
Wed Aug 5 19:27:31 EDT 2009
Hello Jerome,
I know it's been a while but here's how I get the Ids
of the Delaunay neighbors for a point. I took inspiration
of the GetCellNeughbors() function from vtkUnstructuredGrid.
// Delaunay tessellation
delaunay = vtkSmartPointer<vtkDelaunay3D>::New();
delaunay->SetInput(profile);
delaunay->Update();
// build cells links
vtkSmartPointer<vtkCellLinks> cellLinks
= vtkSmartPointer<vtkCellLinks>::New();
cellLinks = vtkSmartPointer<vtkCellLinks>::New();
cellLinks->Allocate(1000);
cellLinks->BuildLinks(delaunay->GetOutput());
// look for neighbors
numCells = cellLinks->GetNcells(i);
cells = cellLinks->GetCells(i);
-> for each point of Delaunay tessellation
-> for each cell
-> for each point in the cell
if not the Delaunay point, let's look if it is a neighbor
if first point of the first cell, store neighbor Id
avoid redundancy
store neighbor Id
I hope this helps if the iterator you need is of that kind.
Lloyd
From: Jérôme [mailto:jerome.velut at gmail.com]
Sent: Wednesday, July 08, 2009 11:40 PM
To: Lloyd Fenelon
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] How to get neighbors with vtkCellLinks ?
Hi,
vtkDelaunay3D is an algorithm, whereas your question deals with data structures. You should investigate the GetCellNeighbors( ) member function from vtkUnstructuredGrid.
If you are allowed to use vtkPolyData, you can take a look at the sources of vtkSmoothPolyDataFilter, that I expect to compute a weighted sum over vertex neighbors.
Let us know if you solve or not your problem: I will have to implement this iterator soon.
'Hope that helps
Jerome
2009/7/8 Lloyd Fenelon <lfenelon at bccrc.ca<mailto:lfenelon at bccrc.ca>>
Hi,
I am using vtkCellLinks after computing a unstructured grid dataset
with vtkDelaunay3D. I would like to get the neighbors of each points.
Nothing comes out of the BuildLinks method the way I use it:
...
vtkSmartPointer<vtkDelaunay3D> delaunay
= vtkSmartPointer< vtkDelaunay3D>::New();
computeDelaunay();
...
vtkSmartPointer<vtkCellLinks> cellLinks
= vtkSmartPointer<vtkCellLinks>::New();
cellLinks->BuildLinks(delaunay->GetOutput());
Actually I don't know how to get back the points Ids
from delaunay so I give the unstuctured grid dataset.
Does someome can explain me what is going wrong here please ?
thank you
Lloyd
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090805/2f978f1e/attachment.htm>
More information about the vtkusers
mailing list