[vtkusers] vtkDelaunay3D does'nt work in C++?

Brad King brad.king at kitware.com
Thu Feb 5 08:55:16 EST 2004


Sentil Balaji wrote:
> Hey,
> 
>    I tried the Delaunay3D exampli in Tcl , it worked
> fine.But, when I programmed it in C++ I get
> errors[listed below].Also, I did not find the header
> file "vtkUnstructuredGridVolumeMapper.h".It is not in
> the CD-ROM that comes with the VTK Users' Guide.
> -----
> CODE
> ----
> 	vtkRenderWindow *w=vtkRenderWindow::New();
> 	vtkRenderWindowInteractor
> *in=vtkRenderWindowInteractor::New();
> 	vtkRenderer *r=vtkRenderer::New();
> 	vtkActor *a=vtkActor::New();
> 	vtkDelaunay3D *d=vtkDelaunay3D::New();
> 	vtkPoints *p=vtkPoints::New();
> 	vtkPolyData *pd=vtkPolyData::New();
> 	vtkPolyDataMapper *pdm=vtkPolyDataMapper::New();
> 	vtkExtractEdges *e=vtkExtractEdges::New();
> 	vtkDataSetMapper *dsm=vtkDataSetMapper::New();
> 	vtkShrinkFilter *sfil=vtkShrinkFilter::New();
> 	vtkMath *math=vtkMath::New();
> 	vtkUnstructuredGridToPolyDataFilter *pdfil;
> 	for(i=1;i<=M;i++)
> 		p->InsertPoint(i,I[i]);
> 	pd->SetPoints(p);
> 	d->SetInput(pd);
> 	d->SetTolerance(0.001);
> 	sfil->SetInput(d->GetOutput());
> 	dsm->SetInput(sfil->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();
> -------
> ERROR
> -------
> :\vtkbase\ren1.cpp(52) : error C2664: 'SetInput' :
> cannot convert parameter 1 from 'class
> vtkUnstructuredGrid *' to 'class vtkDataSet *'
>         Types pointed to are unrelated; conversion
> requires reinterpret_cast, C-style cast or
> function-style cast
> d:\vtkbase\ren1.cpp(53) : error C2664: 'SetInput' :
> cannot convert parameter 1 from 'class
> vtkUnstructuredGrid *' to 'class vtkDataSet *'
>         Types pointed to are unrelated; conversion
> requires reinterpret_cast, C-style cast or
> function-style cast
> Error executing cl.exe.
> 
> REN1.exe - 2 error(s), 0 warning(s)
> ---------------------------------------------------
> 
> Awaiting reply for both the questions..Thanks

Errors like this usually mean there is a missing include.  The compiler 
does not know that vtkUnstructuredGrid is a subclass of vtkDataSet. 
Just add a

   #include "vtkUnstructuredGrid.h"

to the top of the source file.

-Brad




More information about the vtkusers mailing list