<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>Error in Visualizing a Quadric Function</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2 FACE="Arial">Hi vtkusers,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I copy-paste some code for Visualizing a Quadric Function from VTK.ORG website (</FONT><A HREF="http://www.vtk.org/example-code.php"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http://www.vtk.org/example-code.php</FONT></U></A><FONT SIZE=2 FACE="Arial">) and got these errors while testing it under Borland C++ Builder 6 / WinXP / VTK4..2.1. Will someone please tell what is wrong here?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">[C++ Error] Form_Test.cpp(90): E2034 Cannot convert 'vtkImageData *' to 'vtkDataSet *'</FONT>
<BR><FONT SIZE=2 FACE="Arial">[C++ Error] Form_Test.cpp(90): E2342 Type mismatch in parameter 'input' (wanted 'vtkDataSet *', got 'vtkImageData *')</FONT>
<BR><FONT SIZE=2 FACE="Arial">[C++ Error] Form_Test.cpp(106): E2034 Cannot convert 'vtkImageData *' to 'vtkDataSet *'</FONT>
<BR><FONT SIZE=2 FACE="Arial">[C++ Error] Form_Test.cpp(106): E2342 Type mismatch in parameter 'input' (wanted 'vtkDataSet *', got 'vtkImageData *')</FONT>
<BR><FONT SIZE=2 FACE="Arial">[C++ Error] Form_Test.cpp(115): E2315 'SetColor' is not a member of 'vtkProperty', because the type is not yet defined</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">=== Here is the C++ code from the vtk.org website === </FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> // -- create the quadric function object --</FONT>
<BR><FONT SIZE=2 FACE="Arial"> // create the quadric function definition</FONT>
<BR><FONT SIZE=2 FACE="Arial"> vtkQuadric *quadric = vtkQuadric::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> quadric->SetCoefficients(.5,1,.2,0,.1,0,0,.2,0,0);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> // sample the quadric function</FONT>
<BR><FONT SIZE=2 FACE="Arial"> vtkSampleFunction *sample = vtkSampleFunction::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> sample->SetSampleDimensions(50,50,50);</FONT>
<BR><FONT SIZE=2 FACE="Arial"> sample->SetImplicitFunction(quadric);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> // Create five surfaces F(x,y,z) = constant between range specified</FONT>
<BR><FONT SIZE=2 FACE="Arial"> vtkContourFilter *contours = vtkContourFilter::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> contours->SetInput(sample->GetOutput()); // ============= Line 90 ========</FONT>
<BR><FONT SIZE=2 FACE="Arial"> contours->GenerateValues(5, 0.0, 1.2);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> // map the contours to graphical primitives</FONT>
<BR><FONT SIZE=2 FACE="Arial"> vtkPolyDataMapper *contMapper = vtkPolyDataMapper::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> contMapper->SetInput(contours->GetOutput());</FONT>
<BR><FONT SIZE=2 FACE="Arial"> contMapper->SetScalarRange(0.0, 1.2);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> // create an actor for the contours</FONT>
<BR><FONT SIZE=2 FACE="Arial"> vtkActor *contActor = vtkActor::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> contActor->SetMapper(contMapper);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> // -- create a box around the function to indicate the sampling volume --</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> // create outline</FONT>
<BR><FONT SIZE=2 FACE="Arial"> vtkOutlineFilter *outline = vtkOutlineFilter::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> outline->SetInput(sample->GetOutput()); // ============ Line 106 ======</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> // map it to graphics primitives</FONT>
<BR><FONT SIZE=2 FACE="Arial"> vtkPolyDataMapper *outlineMapper = vtkPolyDataMapper::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> outlineMapper->SetInput(outline->GetOutput());</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> // create an actor for it</FONT>
<BR><FONT SIZE=2 FACE="Arial"> vtkActor *outlineActor = vtkActor::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> outlineActor->SetMapper(outlineMapper);</FONT>
<BR><FONT SIZE=2 FACE="Arial"> outlineActor->GetProperty()->SetColor(0,0,0); // ======== Line 115 =========</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">Thanks a lot</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Yang</FONT>
</P>
</BODY>
</HTML>