[vtkusers] update scalars of vtkPoints

Hagen Mölle h.moelle at googlemail.com
Thu Jul 1 08:16:16 EDT 2010


Hi Sebastian,

Thanks for your help. I got it working with vtkPolyData in my 2D 
visualization.

In my 3D visualization of measured points I still have the problem that 
the scalars do not change. There I use vtkUnstructuredGrid instead of 
vtkPolyData. Right now the update routine of the scalars looks like this 
(pseudo code):

scalars = vtkDataSet->GetPointData()->GetScalars()
for(number of scalars)
{
     update each scalar
}
vtkDataSet->Modified()

The code is compiling for vtkUnstructuredGrid and vtkPolyData. But it 
seems I have to do something additional to update the scalars of the 
vtkUnstructuredGrid.

Any idea?

Hagen


> Hello Hagen,
>
> did you forget to call Modified() of the vtkPolyData after altering the points? Otherwise the vtkPolyData does not know that their points, scalars or cells were changed.
>
> Sebastian Barth
>
> -----Ursprüngliche Nachricht-----
> Von: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] Im Auftrag von Hagen Mölle
> Gesendet: Donnerstag, 1. Juli 2010 08:26
> An: John Drescher; vtkusers at vtk.org; sebastien.jourdain at kitware.com
> Betreff: Re: [vtkusers] update scalars of vtkPoints
>
> On 06/30/2010 06:14 PM, John Drescher wrote:
>    
>> 2010/6/30 Sebastien Jourdain<sebastien.jourdain at kitware.com>:
>>
>>      
>>> Hi Hagen,
>>>
>>> As you said, you can start by simply change the data on the fly and
>>> call Render() once the change has been done. By change I mean point
>>> location, scalar data and even point number.
>>> But be aware that only one thread should be used in VTK otherwise they
>>> have to be synchronized.
>>>
>>>
>>>        
>> I think vtkPolyData->GetPointData->GetScalars()
>>
>> is where to start
>>
>> John
>>
>>      
> Hi Sebastien and John,
>
> Thanks for pointing out how to change the scalars of the points on the
> fly. So I need to alter the vtkDataArray which I get by
> vtkPolyData->GetPointData->GetScalars(). Hopefully this will work.
>
> Yesterday I tried to set new scalars by using the following method:
> vtkPolyData->GetPointData->SetScalars(vtkDoubleArray). So I did not
> generate a new dataset. But the visualization did not change during
> update. It seemed the old scalars where used during update.
>
> Hagen
> _______________________________________________
> 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
>    




More information about the vtkusers mailing list