[vtkusers] 3D Delaunay triangulation

Andreas Fabri andreas.fabri at geometryfactory.com
Tue Jun 19 05:57:19 EDT 2007


Hello,

I want to compare the performance of the 3D Delaunay
triangulation of vtk with the one that can be found
in CGAL, the Computational Geometry Algorithms Library.

As I am new in vtk, and as I didn't find a lot of
examples on the 3D Delaunay triangulation, I am wondering
if the below testdriver which reads 3D points from the console
is the right one to perform a benchmark.

Also any existing pointers to benchmarks are highly
appreciated.

Best regards,

Andreas



#include "vtkActor.h"
#include "vtkCamera.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include <vtkDelaunay3D.h>
#include "vtkUnstructuredGrid.h"
#include "vtkDataSetMapper.h"


int main()
{
  	vtkRenderWindow *w=vtkRenderWindow::New();
  	vtkRenderWindowInteractor
     *in=vtkRenderWindowInteractor::New();
  	vtkRenderer *r=vtkRenderer::New();
  	vtkActor *a=vtkActor::New();
  	vtkDelaunay3D *d=vtkDelaunay3D::New();
  	vtkPoints *p=vtkPoints::New();
	float point[3];
	int i = 0;
	while (std::cin >> point[0] >> point[1] >> point[2]){
	    p->InsertPoint(i++, point);
	}
  	vtkPolyData *pd=vtkPolyData::New();
  	vtkDataSetMapper *dsm=vtkDataSetMapper::New();
	
  	pd->SetPoints(p);
  	d->SetInput(pd);
  	d->SetTolerance(0.001);
  	dsm->SetInput(d->GetOutput());
  	a->SetMapper(dsm);
  	in->SetRenderWindow(w);
      w->AddRenderer(r);
  	r->AddActor(a);
  	w->Render();
  	in->Start();
  	w->Delete();
  	in->Delete();
  	r->Delete();
  	a->Delete();
  	//pdm->Delete();
  	pd->Delete();
  	p->Delete();
return 0;
}




More information about the vtkusers mailing list