[vtkusers] reset scalars

David Doria daviddoria at gmail.com
Mon Jul 9 09:03:45 EDT 2012


On Mon, Jul 9, 2012 at 9:01 AM, Gonzalo Amadio <gonzaloamadio at gmail.com>wrote:

> Hello,
>
> Is there a good way of deleting scalars from a polydata?
>
>
> My problem is that I am iterating over the cells of a polydata, and in
> each iteration I want to use a different set of scalars.
> So, in each iterarion I do :
>
>    surface->GetCellData()->SetScalars(myScalarArray);
>
> But I think I have to delete the scalars of the previous iteration, so I
> have only the last array of scalars.
>
>
>
> Another point of view of the question would be :
> doing
>
>    surface->GetCellData()->SetScalars(array1);
>    surface->GetCellData()->SetScalars(array2);
>
> is the same as only
>
>    surface->GetCellData()->SetScalars(array2); ?
>
> or the result of the first case would lead to have the scalars in "array1"
> plus the scalars in "array2" and not only the scalars in "array2".
>
> Thank you.!
>

I believe you are correct that
   surface->GetCellData()->SetScalars(array1);
   surface->GetCellData()->SetScalars(array2);

is the same as only

   surface->GetCellData()->SetScalars(array2);

it should just be setting a pointer, so overwriting the pointer would
not concatenate the data, but just change it.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120709/4f31626d/attachment.htm>


More information about the vtkusers mailing list