[vtkusers] Error in Visualizing a Quadric Function

Xianjin Yang Yang at AGIUSA.COM
Mon Mar 17 19:15:08 EST 2003


Hi vtkusers,

I copy-paste some code for  Visualizing a Quadric Function from VTK.ORG website
(http://www.vtk.org/example-code.php <http://www.vtk.org/example-code.php> ) and
got these errors while testing it under Borland C++ Builder 6 / WinXP /
VTK4..2.1. Will someone please tell what is wrong here?

[C++ Error] Form_Test.cpp(90): E2034 Cannot convert 'vtkImageData *' to
'vtkDataSet *'
[C++ Error] Form_Test.cpp(90): E2342 Type mismatch in parameter 'input' (wanted
'vtkDataSet *', got 'vtkImageData *')
[C++ Error] Form_Test.cpp(106): E2034 Cannot convert 'vtkImageData *' to
'vtkDataSet *'
[C++ Error] Form_Test.cpp(106): E2342 Type mismatch in parameter 'input' (wanted
'vtkDataSet *', got 'vtkImageData *')
[C++ Error] Form_Test.cpp(115): E2315 'SetColor' is not a member of
'vtkProperty', because the type is not yet defined

=== Here is the C++ code from the vtk.org website === 

  // -- create the quadric function object --
  // 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());     //  ============= Line 90
========
  contours->GenerateValues(5, 0.0, 1.2);

  // map the contours to graphical primitives
  vtkPolyDataMapper *contMapper = vtkPolyDataMapper::New();
  contMapper->SetInput(contours->GetOutput());
  contMapper->SetScalarRange(0.0, 1.2);

  // create an actor for the contours
  vtkActor *contActor = vtkActor::New();
  contActor->SetMapper(contMapper);

  // -- create a box around the function to indicate the sampling volume --

  // create outline
  vtkOutlineFilter *outline = vtkOutlineFilter::New();
  outline->SetInput(sample->GetOutput());   // ============ Line 106 ======

  // map it to graphics primitives
  vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();
  outlineMapper->SetInput(outline->GetOutput());

  // create an actor for it
  vtkActor *outlineActor = vtkActor::New();
  outlineActor->SetMapper(outlineMapper);
  outlineActor->GetProperty()->SetColor(0,0,0);    // ======== Line 115
=========


Thanks a lot

Yang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030317/6e612bbc/attachment.htm>


More information about the vtkusers mailing list