[vtkusers] Problem with surface reconstruction and contour filter in C++.
Andrew J. P. Maclean
a.maclean at acfr.usyd.edu.au
Mon Oct 14 02:52:32 EDT 2002
I am using the latest nightly build (13-Oct-2002).
I seem to be unable to reconstruct a surface using
vtkSurfaceReconstructionFilter in C++ with the following code:
// Filled a vtkPolyData structure with points from
nPts = polyData->GetNumberOfPoints();
// A nPts = 3337 points
surf->SetInput( polyData );
nPts = ((vtkDataSet * )surf->GetOutput())->GetNumberOfPoints();
// B nPts = 75760 points
((vtkDataSet * )surf->GetOutput())->GetBounds(bounds);
// Contour at 0 to extract the surface.
vtkContourFilter * cf = vtkContourFilter::New();
cf->SetInput( (vtkDataSet * )surf->GetOutput());
nPts = cf->GetOutput()->GetNumberOfPoints();
// C nPts = 0 points
// Sometimes the contouring algorithm can create a volume whose
// vector and ordering of polygon (using the right hand rule) are
// inconsistent. vtkReverseSense cures this problem.
vtkReverseSense * rev = vtkReverseSense::New();
This is a translation of the TCL code in the example
polyData is a vtkPolyData structure filled with points from the file
nPts at point A has the value: 3337. At B, npts = 75760, which is
expected as the surface
has been constructed. However at C, nPts is zero and the bounds all have
VTK_LARGE_FLOAT in them!
The contour filter doesn't seem to be producing any output.
One oddity now is that I have had to put in the type conversion
(vtkDataSet * ) at the indicated points as a result of the VC7 compiler
'vtkDataSetToPolyDataFilter::SetInput' : cannot convert parameter 1 from
'vtkImageData *' to 'vtkDataSet *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
I thought that vtkContourFilter takes any dataset (and this is supported
by the documentation).
This type conversion did not have to be specified in the older nightly
builds ( before August).
Another oddity is that the TCL example code works OK ( I am using
Can someone please help?
Andrew J. P. Maclean
Australian Centre for Field Robotics
The Rose Street Building J04
The University of Sydney 2006 NSW
Phone: +61 2 9351 3283
Fax: +61 2 9351 7474
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers