[vtkusers] Problem with surface reconstruction and contour filter in C++.
Andrew J. P. Maclean
a.maclean at acfr.usyd.edu.au
Tue Oct 22 01:25:03 EDT 2002
I found the problem! It has to do with Update(). If you do
surf->Update(); immediately after surf->SetInput() contouring doesn't
work.
So the following code works OK.
polyData->Modified();
surf->SetInput( polyData );
// Contour at 0 to extract the surface.
vtkContourFilter * cf = vtkContourFilter::New();
cf->SetInput( surf->GetOutput() );
cf->SetValue(0,0.0);
// Sometimes the contouring algorithm can create a
volume whose gradient
// vector and ordering of polygon (using the right hand
rule) are
// inconsistent. vtkReverseSense cures this problem.
vtkReverseSense * rev = vtkReverseSense::New();
rev->SetInput(cf->GetOutput());
rev->ReverseCellsOn();
rev->ReverseNormalsOn();
rev->Update();
//polyData->Reset();
polyData->Initialize();
polyData->DeepCopy(rev->GetOutput());Andrew
___________________________________________
Andrew J. P. Maclean
Postal:
Australian Centre for Field Robotics
The Rose Street Building J04
The University of Sydney 2006 NSW
AUSTRALIA
Room: 106
Phone: +61 2 9351 3283
Fax: +61 2 9351 7474
http://www.acfr.usyd.edu.au/
___________________________________________
-----Original Message-----
From: John Biddiscombe [mailto:jbiddiscombe at skippingmouse.co.uk]
Sent: Tuesday, 15 October 2002 10:29
To: a.maclean at acfr.usyd.edu.au; vtkusers at public.kitware.com
Subject: Re: [vtkusers] Problem with surface reconstruction and contour
filter in C++.
> However it still doesn't fix my problem, in that the contour filter is
> not returning any data.
Oh. Sorry, I only looked at the compile error. My first guess would be
// Description:
// If you want to contour by an arbitrary array, then set its name
here.
// By default this in NULL and the filter will use the active scalar
array.
vtkGetStringMacro(InputScalarsSelection);
void SelectInputScalars(const char *fieldName)
{this->SetInputScalarsSelection(fieldName);}
Try setting the scalar name to something appropriate and see if that
helps.
Could be somehow you're getting a different scalar name in your data
somehow
(and the contour filter isn't using it).
JB
More information about the vtkusers
mailing list