[vtkusers] Adding points dynamically
    Grzegorz Pytel 
    bioinfguy at gmail.com
       
    Sat May  2 06:34:57 EDT 2009
    
    
  
I have following variables:
I want to have points added dynamically on mouse click event and force the
gaussian filter to create surface out of modified points and have it
displayed. The commands like splatMapper->Update() or contour->Update() do
not take effect. How should I force GaussianSplatter to recompute surface
and redraw?
I store points in points like this:
vtkPoints * points;
vtkCellArray * vertices;
vtkGaussianSplatter * splatter;
vtkPolyData * pData;
pData = vtkPolyData::New();
    pData->SetPoints(points);
    pData->SetVerts(vertices);
I use my own function that returns pointer to GaussianSplatter:
vtkGaussianSplatter* GetGaussianSplatter() { return splatter }
My filters I have set up as following:
vtkContourFilter * contour;
    vtkPolyDataMapper *splatMapper;
contour = vtkContourFilter::New();
contour->SetInputConnection(this->sculpture->GetGaussianSplatter()->GetOutputPort());
    contour->SetValue(0, 0.9);
    //contour->SetInput(sculpture->GetGaussianSplatter()->GetOutput());
    splatMapper = vtkPolyDataMapper::New();
    splatMapper->SetInput(contour->GetOutput());
    splatActor = vtkActor::New();
    splatActor->SetMapper(splatMapper);
    renderer->AddActor(splatActor);
This code does not work properly I have on mouse left down event:
for(int i=0;i<1000;i++)
    {
        double np[3];
        np[0] = rand()/RAND_MAX;
        np[1] = rand()/RAND_MAX;
        np[2] = rand()/RAND_MAX;
        sculpture->AddPoint(np);
    }
void Sculpture::AddPoint(double point[])
{
    this->points->InsertNextPoint(point);
    this->vertices->InsertNextCell(1);
    this->vertices->InsertCellPoint(0);
}
Thanks in advance,
Gregory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090502/c66ae488/attachment.htm>
    
    
More information about the vtkusers
mailing list