[vtkusers] why does Updating scalars updates Delaunay Object too?

rakesh patil prakeshofficial at gmail.com
Wed Sep 14 06:35:22 EDT 2011


Hello,

vtkPoints *pnts = vtkPoints::New();
pnts->SetNumberOfPoints(num);

vtkDoubleArray *scalar = vtkDoubleArray::New();
scalar->SetNumberOfTuples(num);

vtkCellArray *pVertex = vtkCellArray::New();

for (vtkIdType i = 0; i < num; i++)
{
   readFile >> xval >> yval >> zval;
   pnts->InsertPoint(i, xval, yval, 0);
   scalar->InsertTuple1(i, zval);
   pVertex->InsertNextCell(1, &i);
}

vtkPolyData *pd = vtkPolyData::New();
pd->SetPoints(pnts);
pd->SetVerts(pVertex);
pd->GetPointData()->SetScalars(scalar);

vtkDelaunay2D *del = vtkDelaunay2D::New();
del->SetInput(pd);
del->SetTolerance(0.00001);
del->Update();

vtkPolyDataMapper *mapp = vtkPolyDataMapper::New();
mapp->SetInputConnection( del->GetOutputPort() );
mapp->ScalarVisibilityOn();

vtkActor *actor = vtkActor::New();
actor->SetMapper(mapp);
actor->GetProperty()->SetColor(1, 0, 0);
actor->GetProperty()->SetPointSize(3);

renderer->AddActor(actor);

After adding actor to the renderer, suppose I do some changes in the
scalar array, and say modified, I observe that delaunay object is also
updated and again triangulation takes place.

Why is this so?
;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110914/0c6b43b4/attachment.htm>


More information about the vtkusers mailing list