[vtk-developers] Add GetPoint function to vtkStructuredGrid
Francois Bertel
francois.bertel at kitware.com
Fri Feb 5 13:47:33 EST 2010
Use vtkStructuredData::ComputePointIdForExtent() to get the point id,
then get the coordinates on the vtkPoints object.
and your code is wrong:
1.you passes arguments x,y,z per value
2.you check and compute against dimensions instead of extent.
On Fri, Feb 5, 2010 at 1:25 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> There currently doesn't seem to be a way to access points in the "grid"
> (x,y,z) structure. Can we add this function:
> void vtkStructuredGrid::GetPoint(int x, int y, int z, double p[3])
> {
> int dims[3];
> this->GetDimensions(dims);
>
> if(x >= dims[0] || y >= dims[1] || z >= dims[2])
> {
> return; // out of bounds!
> }
>
> int ind = z*dims[1]*dims[0] + y*dims[0] + x;
> //cout << "x: " << x << " y: " << y << " z: " << z << " ind: " << ind <<
> endl;
>
> grid->GetPoint(ind, p);
> }
> Thanks,
>
> David
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
>
--
François Bertel, PhD | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
| Clifton Park NY 12065, USA
More information about the vtk-developers
mailing list