[vtkusers] get reference of point array in vtkPolyData
Kyle Lutz
kyle.lutz at kitware.com
Wed Nov 14 10:17:32 EST 2012
You could use:
float *points = reinterpret_cast<float
*>(polyData->GetPoints()->GetVoidPointer(0));
Cheers,
Kyle
On Wed, Nov 14, 2012 at 7:15 AM, David Doria <daviddoria at gmail.com> wrote:
> On Wed, Nov 14, 2012 at 9:54 AM, abusq <albert.busque at gmail.com> wrote:
>>
>> Hi everyone, here's my question:
>> I have a polydata object with all my points and i would like to get the
>> reference of array containing the tuples/points.
>> Just like polydata->GetAllPoints(double **) or something...
>> Is it possible? and how?
>>
>> Thanks
>
>
> You can do something like this:
>
>
> #include <vtkSmartPointer.h>
>
> #include <vtkPoints.h>
>
>
> int main (int , char *[])
>
> {
>
> vtkSmartPointer<vtkPoints> points =
>
> vtkSmartPointer<vtkPoints>::New();
>
>
> points->InsertNextPoint(1,2,3);
>
> points->InsertNextPoint(4,5,6);
>
>
> float* data = reinterpret_cast<float*>(points->GetVoidPointer(0));
>
>
> for(unsigned int i = 0; i < 6; ++i)
>
> {
>
> std::cout << data[i] << " ";
>
> }
>
>
> std::cout << std::endl;
>
> }
>
>
> David
>
>
> _______________________________________________
> Powered by 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
>
More information about the vtkusers
mailing list