[vtkusers] Picking field data for unstructured points

Joseph_Winston at veritasdgc.com Joseph_Winston at veritasdgc.com
Thu Sep 12 10:46:33 EDT 2002


I have unstructured points, scalars, and field data inside a
vtkPolyData.  A surface is constructed and then displayed by using the
following pipeline:

vtkShepardMethod -> vtkExtractVOI -> vtkGeometryFilter ->
vtkClipPolyData -> vtkWarpScalar -> vtkPolyDataNormals ->
vtkSmoothPolyDataFilter -> vtkCleanPolyData -> vtkTriangleFilter ->
vtkTriangleFilter -> vtkStripper -> vtkDataSetMapper

A vtkPropPicker or a vtkCellPicker is added as an observer on the
vtkCommand::EndPickEvent.

In the callback I can see the field data:

   cout << "number of arrays: " << polyData->GetFieldData()
->GetNumberOfArrays() << endl;
   cout << "first array name: " << polyData->GetFieldData()
->GetArrayName(0) << endl;
   cout << "second array name: " << polyData->GetFieldData()
->GetArrayName(1) << endl;

I then construct a vtkFieldDataToAttributeDataFilter, a
vtkDataObjectToDataSetFilter, and a vtkCellLocator.  I do not see how
I am to get the Cell Connectivity for the vtkDataObjectToDataSetFilter.

   vtkFieldDataToAttributeDataFilter *fd2ad =
vtkFieldDataToAttributeDataFilter::New();
   fd2ad->SetInput(polyData);
   fd2ad->SetInputFieldToDataObjectField();
   fd2ad->SetScalarComponent(0, "Attributes", 0);
   fd2ad->SetOutputAttributeDataToCellData();
   fd2ad->Update();          // Needed???

   vtkDataObjectToDataSetFilter *filter = vtkDataObjectToDataSetFilter::New
();
   filter->SetInput(fd2ad->GetOutput());
   filter->SetCellTypeComponent("Attributes", 0);
//      filter->SetCellConnectivityComponent("???", X);  // how is this
done?
   filter->Update();          // Needed???

   vtkCellLocator *locator = vtkCellLocator::New();
   locator->SetDataSet(filter->GetOutput());

   // ******
   // The "problem" occurs here in BuildLocator since it returns
   // because (numCells = this->DataSet->GetNumberOfCells()) < 1 )
   // ******
   locator->BuildLocator();

   float closestPoint[3];
   vtkIdType cellId = 0;
   int subId = 0;
   float dist2 = 0;

   // ******
   // This call fails since this->NumberOfOctants is not set.
   // ******

   locator->FindClosestPoint(pickPos,
                             closestPoint,
                             cellId,
                             subId,
                             dist2);

Where do I get the Cell Connectivity in my pipeline since I'm starting
with unstructured data?  Or what should I do to pick field data when
I'm starting with unstructured points?

Thanks





********************************************************************************
Any  opinions  expressed  in  this  email or its  attachments are those   of the
individual  and not  necessarily  the  Company. The  information  transmitted is
intended only for the person  or entity to which it is addressed and may contain
confidential   and/or   privileged   material.   Any   review,  re-transmission,
dissemination or  other use of, or taking  of any action in  reliance upon, this
information by persons or  entities other than  the intended recipient, without
express  consent from the sender, is prohibited. Internet communications are not
necessarily secure.  No responsibility  is accepted  for changes made after this
information was sent. If you  received this in error, please contact the  sender
and delete the material from any computer.
********************************************************************************




More information about the vtkusers mailing list