[vtkusers] point probe from unstructured grid

Thomas Lozano tholozano at gmx.de
Thu Jun 12 05:37:47 EDT 2003


hi

I use vtk as part of a visualisation pipeline and want to probe only some
points of my source data. 
So I want to get the scalar at the specific xyz coordinates. My source data
comes from an vtkUnstructuredGridReader.

I tried to solve this problem like this:

...
float p[3];
float zahl;
float *rgb = new float[3];

float pcoords[3];
float *weights;
int subId;
vtkCell *cell;

// example point
p[0] = 1.5; p[1] = 1.0; p[2] = 6.0;

vtkUnstructuredGridReader *reader = vtkUnstructuredGridReader::New();
  reader->SetFileName("file.vtk");
  reader->SetScalarsName("scalars");
  reader->Update();

cell = reader->GetOutput()->FindAndGetCell(p, NULL, 0, 0.1, subId, pcoords,
weights);

vtkPointData *output = vtkPointData::New();
  output->InterpolateAllocate(reader->GetOutput()->GetPointData());
  output->InterpolatePoint(reader->GetOutput()->GetPointData(), 0,
cell->GetPointIds(), weights);

// and here should be what I´m looking for !
zahl = output->GetScalars()->GetTuple1(0);


but I always get an windows error message.  After debugging with visual i
know that the method
FindAndGetCell(p, NULL,...); didn´t return any values for weights, so it´s
no wonder if the pipeline crashes.

Is the probeFilter buggy, or does anyone has an idea??

thanks!

thomas


-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!




More information about the vtkusers mailing list