[vtkusers] isosurface update issue

newcfd newcfd at yahoo.com
Fri Nov 30 00:12:05 EST 2018


I have the following code to draw isosurface. No problem when this func is
called by the first time.
However, two isosurfaces show up when this func is called with a different
value by the second time.
The first isosurface is not replaced by the second one although I am using
the same actor. What is 
wrong?

void MyApp::redraw( const double value )
{
  vtkStructuredGrid * mesh =...

  vtkSmartPointer<vtkContourFilter> filter =
vtkSmartPointer<vtkContourFilter>::New();
  filter->SetInputData( mesh );
  filter->SetNumberOfContours( 1 );
  filter->Setvalue( 0, value ); // value is passed in

 vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
 mapSphere->SetInputConnection( filter->GetOutputPort() );
 mapSphere->SetScalarRange(0.0, 1.0);

 if ( m_pActor == nullptr )
 {
    m_pActor = vtkActor::New();
    m_pActor->SetMapper( mapper );
  }

 renderer->AddActor( m_pActor );
 renderer->SetBackground(1,1,1); // Background color white
 
 renderWindow->Render();
}



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list