[vtkusers] Correct implementation of vtkImageData -> FindCell (...)

Jake Nickel jake.nickel at gmail.com
Thu Jan 24 17:32:28 EST 2008


Thanks a bunch, Dean!  Changing "double * fweights" to "double fweights[8]"
solved my problem!

Thanks again!
-Jake

On Jan 23, 2008 3:41 PM, <dean.inglis at camris.ca> wrote:

> Hi Jake,
>
> could be segfaulting due to
> double * fweights;
> which can be fixed with
>
> double  fweights[8];
>
> see how vtkImageData calls FindCell at line 747...
>
> Dean
>
>
> /********************begin code**********************/
> ...
>  //double p[3] is initialized
> ...
>  vtkEmptyCell * femptycell = vtkEmptyCell::New();
>  vtkCell * fcell = femptycell->NewInstance();
>  vtkIdType fcellID;
>  double ftol2;
>  int fsubId;
>  double fpcoords[3];
>  double * fweights;
>
>  vtkIdType fFindCell = [instance of vtkImageData *]->FindCell(p, fcell,
> fcellID, ftol2, fsubId, fpcoords, fweights);
>
>  std::cout << "cellID returned from FindCell() = " << fFindCell <<
> std::endl;
> /********************end code**********************/
>
> When I click on one of the orthogonal slices, my application successfully
> prints out the cellId, for instance:
>
> "cellID returned from FindCell() = 42196578"
>
> However, it then crashes with a Segmentation Fault.  I have narrowed the
> problem down to this chunk of code because when I replace it with similar
> code to compute the cell ID (pasted below), it runs fine without any seg
> fault.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080124/4823b19a/attachment.htm>


More information about the vtkusers mailing list