[vtkusers] Help with vtkDelaunay3D - example does not compile.
Moore, Brett
BRETT.MOORE at ttu.edu
Sat Aug 23 16:13:27 EDT 2003
Hi,
I need to mesh a 3D point cloud, and I have attempted to replicate the /Examples/Modelling/Tcl/Delaunay3D.tcl in c++ (redhat 9, gcc 3.2.2, VTK 4.2.2):
<snip>
#include "vtkCamera.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPolyData.h"
#include "vtkPolyDataMapper.h"
#include "vtkDataSetMapper.h"
#include "vtkActor.h"
#include "vtkPolyDataMapper.h"
#include "vtkBMPWriter.h"
#include "vtkDelaunay3D.h"
#include "vtkShrinkFilter.h"
#include "vtkPoints.h"
<snip>
vtkDelaunay3D *del3D = NULL;
vtkDataSetMapper *mapper = NULL;
vtkShrinkFilter *shrink = NULL;
vtkPolyData *poly = NULL;
vtkPoints *points = NULL;
<snip>
points = vtkPoints::New();
for (i=0;i<count;i++)
{
ifs.read((char*)&x, sizeof(double));
ifs.read((char*)&y, sizeof(double));
ifs.read((char*)&z, sizeof(double));
points -> InsertPoint(i, x,y,z);
}
<snip>
poly = vtkPolyData::New();
poly -> SetPoints(points);
del3D = vtkDelaunay3D::New();
del3D -> SetInput(poly);
del3D -> SetTolerance(0.01);
del3D -> SetAlpha(0.2);
del3D -> BoundingTriangulationOff();
shrink = vtkShrinkFilter::New();
shrink -> SetInput(del3D -> GetOutput());
shrink -> SetShrinkFactor(0.9);
mapper = vtkDataSetMapper::New();
mapper -> SetInput(shrink -> GetOutput());
Unfortunately, the above fails to compile:
g++ -g -Wno-deprecated -c surface.cpp -I/usr/local/include/vtk
surface.cpp: In function `int main(int, char**)':
surface.cpp:178: no matching function for call to `vtkShrinkFilter::SetInput(
vtkUnstructuredGrid*)'
/usr/local/include/vtk/vtkDataSetToUnstructuredGridFilter.h:43: candidates are:
virtual void vtkDataSetToUnstructuredGridFilter::SetInput(vtkDataSet*)
surface.cpp:182: no matching function for call to `vtkDataSetMapper::SetInput(
vtkUnstructuredGrid*)'
/usr/local/include/vtk/vtkDataSetMapper.h:59: candidates are: void
vtkDataSetMapper::SetInput(vtkDataSet*)
The same sort of errors occur if I omit the shrink step and pass del3D -> GetOutput() directly to mapper.
Any ideas? This one is killing me!.
Thanks, Brett
More information about the vtkusers
mailing list