[vtkusers] vtkContourFilter and vtkSampleFunction with vtk4.2 on Windows

Paul McGuinness mcguinpg at maths.tcd.ie
Fri Aug 22 10:10:33 EDT 2003


Try including:
#include "vtkDataSet.h"
#include "vtkImageData.h"

and use this:
   vtkContourFilter *contours = vtkContourFilter::New();
   contours->SetInput((vtkDataSet *)sample->GetOutput());



On Fri, 22 Aug 2003, Philippe Pouletaut wrote:

> I have tested the example 2 (visualising a quadric function) shown in the web site (http://www.vtk.org/example-code.php) with vtk4.2.
> But I cannot compile the C++ file with VisualC++ because of problem of type compatibility between vtkContourFilter and vtkSampleFunction : the compiler indicates that he cannot convert the input from 'class vtkImageData *' to 'class vtkDataSet *'.
> I have indicated to VisualC++ the include library : c:\Program Files\vtk42\include\vtk.
>
> I give in the following the lines of program :
>
> ========================================================
> #include "vtkProperty.h"
> #include "vtkQuadric.h"
> #include "vtkSampleFunction.h"
> #include "vtkContourFilter.h"
> #include "vtkOutlineFilter.h"
> #include "vtkPolyDataMapper.h"
> #include "vtkActor.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderer.h"
> #include "vtkRenderWindowInteractor.h"
>
> void main ()
> {
>   // create the quadric function definition
>   vtkQuadric *quadric = vtkQuadric::New();
>   quadric->SetCoefficients(.5,1,.2,0,.1,0,0,.2,0,0);
>
>   // sample the quadric function
>   vtkSampleFunction *sample = vtkSampleFunction::New();
>   sample->SetSampleDimensions(50,50,50);
>   sample->SetImplicitFunction(quadric);
>
>   // Create five surfaces F(x,y,z) = constant between range specified
>   vtkContourFilter *contours = vtkContourFilter::New();
>   contours->SetInput(sample->GetOutput());
> ========================================================
>
> The last line doesn't work.
> The same problem occurs with vtkSampleFunction as input for vtkOutlineFilter.
>
> Can anyone help me ?
>
> I thank you for your next reply or for your attention.
>
> Philippe
>
>
>
>




More information about the vtkusers mailing list