[vtkusers] Regarding vtkFieldData

Neerajk neerajk at vitinfotech.com
Sat Oct 9 01:18:24 EDT 2004


Hi all

I want to add my field data into vtkpolydata to keep information about modified data, if I do apply any filter on polydata, then I am getting the same field data as it was earlier.
Here is what I am doing discussed below, please let me know if any part of the logic is wrong here or I am expecting a behavior which is not there.

a. I create vtkPolydata and add VtkPoints and vtkCellArray.

b. Then to this polydata I add vtkFieldData( Having a float array ) by calling SetFieldData.

c. Create a VtkDecimatePro filter and decimate the polydata created in step a.

d. Get the output polydata from filter and call GetFieldData().

Result: The FieldData come out without any modification but the vtk points are reduced.

Question again: 
1. Aren't filter suppose to modify field data?


vtkFloatArray *pElement = vtkFloatArray::New();
for (i=0; iInsertTuple1(i,i);
pElement->SetName("Element");
vtkFieldData *pFieldData = vtkFieldData::New();
pFieldData->AddArray(pElement);

vtkPolyData *cube = vtkPolyData::New();
cube->SetPoints(points);
cube->SetPolys(polys);
cube->GetPointData()->SetScalars(scalars);
cube->SetFieldData(pFieldData);

vtkDecimatePro *pFilter = vtkDecimatePro::New();
pFilter->SetInput( cube );
pFilter->SetTargetReduction( 50 );
pFilter->PreserveTopologyOn();
pFilter->BoundaryVertexDeletionOff();
pFilter->SetFeatureAngle( 90 );
pFilter->UpdateWholeExtent();

vtkFieldData *pFieldDataNew = pFilter->GetOutput()->GetFieldData();
vtkFloatArray *pElementNew = (vtkFloatArray *)pFieldDataNew->GetArray("Element");


Thanks & Regards
Neeraj





More information about the vtkusers mailing list