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

Philippe Pouletaut philippe.pouletaut at utc.fr
Fri Aug 22 09:07:50 EDT 2003


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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030822/03159c7b/attachment.htm>


More information about the vtkusers mailing list