[vtkusers] (vtk 4.2 ->4.5) Problem with double* vtkPoints::GetPoint(p) not working as it did

Brad King brad.king at kitware.com
Fri Mar 12 10:52:45 EST 2004


Sebastien Valette wrote:
> Hi,
> 
> I have a problem with the last version ov vtk (4.5) : 
> the method double *vtkPoints::GetPoint(Id)  does not work as it did before. 
> Here is a sample code:
> 
> double *P1,*P2;
> vtkIdType v1,v2;
> vtkPoints *Points;
> 
> P1=Points->GetPoint(v1);
> P2=Points->GetPoint(v2);     
> 
> even if v1 and v2 have different values, the pointers P1 and P2 will be equal. 
> This was not the case with vtk 4.2 where P1 and P2 were different, and we 
> were able to adress several points simultaneously.
> 
> My question is : will this issue remain in future vtk Releases or this is only 
> due to the major updates happening to the vtk Library, and will then be fixed 
> in the future?

I'm pretty sure that in previous releases this technique would only work 
with float* because points were represented with a vtkFloatArray by 
default.  Technically code that depended on referencing multiple points 
in this way was broken before because it was not guaranteed that 
vtkFloatArray was used to represent the points, so the pointer returned 
from GetPoint may not have been pointing into the actual array of point 
coordinates.  The pointer should never have been used to set points 
either.  Referencing multiple points in this way is no longer supported. 
  Use this instead:

double P1[3], P2[3];
vtkIdType v1,v2;
vtkPoints* Points;
//...
Points->GetPoint(v1, P1);
Points->GetPoint(v1, P2);

-Brad



More information about the vtkusers mailing list