[vtkusers] vtkpointId and vtkcellid

Amitesh Agarwal amiteshagarwal at gmail.com
Fri Aug 18 10:48:19 EDT 2006


Hello Kevin,

Thanks a lot for the help. I have one more question.

If I have a point coordinate is it possible to find its pointid and cell id
of the cell in which the point lies? If yes then how?

Amitesh

On 8/18/06, Kevin H. Hobbs <hobbsk at ohiou.edu> wrote:
>
> On Fri, 2006-08-18 at 00:42 -0500, Amitesh Agarwal wrote:
> > Hi all,
> >
> > I have read an unstructured grid and have converted the grid in
> > polydata. I have been trying to access individual cell information and
> > point information serially in the polydata but to no avail. The
> > problem is that all of these have some kind of vtkid assigned to each
> > of the cell and point. I have grown immensly frustrated trying to find
> > a way to access a list of those vtkids so that I could be able to use
> > them to access the individual cells and points. Any ideas how to do
> > it? Any help will be greatly appreciated.
> >
> > Thanks
> >
> > Amitesh
>
>
>
>
> // Make a reader.
> vtkXMLPolyDataReader * reader = vtkXMLPolyDataReader::New();
> reader->SetFileName( in_poly_file_name );
> reader->Update();
>
> in_poly = reader->GetOutput();
> in_poly->BuildLinks();
>
> // Get the cells and points.
> vtkCellArray * in_lines  = in_poly->GetLines();
> vtkPoints    * in_points = in_poly->GetPoints();
>
> // How many are there?
> vtkIdType num_cells  = in_lines->GetNumberOfCells();
> vtkIdType num_points = in_points->GetNumberOfPoints();
>
> // Visit the points.
> vtkIdType point;
> for (point = 0; point < num_points; ++point )
> {
>         // What is the point's location?
>         double * pcoord;
>         pcoord = in_poly->GetPoint( point );
>
>         std::cout << pcord[0] << " "
>         << pcord[1] << " "
>         << pcord[2] << std::endl;
> }
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060818/8390c515/attachment.htm>


More information about the vtkusers mailing list