[vtkusers] vtkPoints array management
Fred Fred
stan1313 at hotmail.fr
Fri Sep 11 12:15:26 EDT 2009
Ok thank you for the tip but this involves a copy of the points, I would have appreciated a way of traversing the list of points while avoiding copies.
> Date: Fri, 11 Sep 2009 10:20:36 -0400
> Subject: Re: [vtkusers] vtkPoints array management
> From: bill.lorensen at gmail.com
> To: stan1313 at hotmail.fr
> CC: vtkusers at vtk.org
>
> Avoid using GetPoint(id). It calls this->GetData->GetTuple(id). The
> comments for GetTuple say it all...
> // Description:
> // Get the data tuple at ith location. Return it as a pointer to an array.
> // Note: this method is not thread-safe, and the pointer is only valid
> // as long as another method invocation to a vtk object is not performed.
> virtual double *GetTuple(vtkIdType i) = 0;
>
> Use
> double pts0[3];
> points->GetPoint(0, pts0);
>
> double ptsn[3];
> points->GetPoint(1, ptsn);
>
> Bill
>
> On Fri, Sep 11, 2009 at 8:52 AM, Fred Fred <stan1313 at hotmail.fr> wrote:
> > Look at this men:
> >
> > vtkPoints *points = vtkPoints::New();
> > [...some point adding steps...]
> > int numPts = points->GetNumberOfPoints();
> > printf("numPts=%d\n", numPts);
> > double *pts0 = points->GetPoint(0);
> > double *ptsn = points->GetPoint(1);
> > printf("%p %p\n", pts0, ptsn);
> >
> > which leads:
> >
> > numPts=11
> > 0x19982c40 0x19982c40
> >
> > Whatever the possibility I Made some mistake anywhere, I can not understand
> > how this is possible!
> > GetPoint(0) returns the same address as GetPoint(1) while there are 11
> > points in the array!!!
> >
> >
> > ________________________________
> > Messenger débarque dans Hotmail ! Essayez-le !
> > _______________________________________________
> > 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
> >
> >
_________________________________________________________________
Messenger débarque dans Hotmail ! Essayez-le !
http://www.windowslive.fr/hotmail/web-messenger/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090911/4a7a02ce/attachment.htm>
More information about the vtkusers
mailing list