[vtk-developers] How to set several scalars to vtkPoint ?

houssen houssen at ipgp.fr
Sun Apr 2 12:01:02 EDT 2017


Hello,

How to set several scalars to vtkPoint ?

Seems vtkDataPoint scratchs the previous scalar array ?!

vtkSmartPointer<vtkIntArray> data1 = 
vtkSmartPointer<vtkIntArray>::New(); data1->SetName("data1");
vtkSmartPointer<vtkIntArray> data2 = 
vtkSmartPointer<vtkIntArray>::New(); data2->SetName("data2");
for (...) {data1->SetValue(idx, d1[i]); data2->SetValue(idx, d2[idx]) }
uGrid->GetPointdata()->SetScalars(data1); // OK
uGrid->GetPointdata()->SetScalars(data2); // data2 scratch data1 ?!

uGrid->GetPointdata()->SetActiveScalar("data1") does not do what I need 
: seems that it activate data1 back but "scratch" data2 back.

uGrid is a vtkUnstructuredGrid : the final goal is to write the grid to 
a file (with vtkWriter). In this file, I'd like to have BOTH data1 and 
data2 for points.
I only get either one or the other... How to get both ?

Also tried to create a N-sized-vector (N=2 or 4) to associate to the 
vtkPoint : does not work as it seems vector dimension MUST be 3. I 
somebody knows a solution to attach a N-sized-vector to a vtkPoint, it 
could solve my problem

Franck

PS : found nothing relevant on the web, targetting VTK-7.


More information about the vtk-developers mailing list