[vtkusers] vtkDelaunay3D

Afonso Paiva Neto apneto at mat.puc-rio.br
Thu Sep 11 21:53:01 EDT 2003


I have some problems to compile a program using vtkDelaunay3D, my code
is:


#include "vtkActor.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
#include "vtkDelaunay3D.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"

int main( int argc, char *argv[] ) {
	
  vtkPoints* points = vtkPoints::New();
  points->InsertPoint(0,1.0,2.0,3.0);
  points->InsertPoint(1,3.0,6.0,4.0);
  points->InsertPoint(2,7.0,9.0,12.0);
  points->InsertPoint(3,11.0,21.0,23.0);
  points->InsertPoint(4,23.0,31.0,43.0);
	
  vtkPolyData* polydata = vtkPolyData::New();
  // Assign points and cells
  polydata->SetPoints(points);
	
  vtkDelaunay3D* del = vtkDelaunay3D::New();
  del->SetInput(polydata);
  del->BoundingTriangulationOn();
  del->SetTolerance(0.01);
  del->SetAlpha(0.2);

	
  vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
  mapper->SetInput(del->GetOutput());
	
  // Create an actor.
  vtkActor* actor = vtkActor::New();
  actor->SetMapper(mapper);
  // Create the rendering objects.
  vtkRenderer* ren = vtkRenderer::New();
  ren->AddActor(actor);
  ren->SetBackground( 1.0, 1.0, 1.0 );

  vtkRenderWindow* renWin = vtkRenderWindow::New();
  renWin->AddRenderer(ren);
  
  vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(renWin);
  iren->Initialize();
  iren->Start();
 
  points->Delete();
  del->Delete();
  polydata->Delete();
  mapper->Delete();
  actor->Delete();
  ren->Delete();
  renWin->Delete();
  iren->Delete();

return 0;
}

the error occurs in mapper->SetInput(del->GetOutput()), any help is
welcome.
 

-- 
Afonso Paiva Neto
e-mail: apneto at mat.puc-rio.br
MatMidia Lab. - PUC-RIO
Rio de Janeiro - Brazil




More information about the vtkusers mailing list