[vtkusers] vtkPoints array management

Fred Fred stan1313 at hotmail.fr
Sat Sep 12 11:31:25 EDT 2009


I already use it but now I wonder if it is safe since in vtkAbstractData doc, it is described as:
  "Implemented in vtkBitArray, vtkDataArrayTemplate< T >, vtkStringArray, and vtkVariantArray."
Does i means that for vtkDoubleArray for instance, it may not be implemented and thus not more reliable than vtkPoints::GetPoint()?

> Date: Fri, 11 Sep 2009 12:27:51 -0400
> From: francois.bertel at kitware.com
> To: vtkusers at vtk.org
> Subject: Re: [vtkusers] vtkPoints array management
> 
> For direct access to the raw pointer of the c array, use
> points->GetVoidPointer(0)
> 
> ref:
> http://www.vtk.org/doc/nightly/html/classvtkPoints.html#6790380ebdd771dd29a9b69a254fb53e
> 
> On Fri, Sep 11, 2009 at 12:15 PM, Fred Fred <stan1313 at hotmail.fr> wrote:
> > 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
> >> >
> >> >
> >
> > ________________________________
> > Vous cherchez l'intégrale des clips de Michael Jackson ? Bing ! Trouvez !
> > _______________________________________________
> > 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
> >
> >
> 
> 
> 
> -- 
> François Bertel, PhD  | Kitware Inc. Suite 204
> 1 (518) 371 3971 x113 | 28 Corporate Drive
>                       | Clifton Park NY 12065, USA
> _______________________________________________
> 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

_________________________________________________________________
A la recherche de bons plans pour une rentrée pas chère ? Bing ! Trouvez !
http://www.bing.com/search?q=bons+plans+rentr%C3%A9e&form=MVDE6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090912/3b1a4e01/attachment.htm>


More information about the vtkusers mailing list