[vtkusers] error C2664: 'SetInput' : cannot convert parameter 1 from 'class vtkImageData *'

Ramisetti Srinivas srinin008 at hotmail.com
Tue Jul 26 10:31:44 EDT 2005


hi ,
I am new to VTK.....
I encountered a problem using this code,when comiled with VC++6...
here is my code and the error....
plz help me


// First include the required header files for the VTK classes we are using.
#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkInteractorStyleTrackballCamera.h"
#include "vtkElevationFilter.h"
#include "vtkSphereSource.h"
#include "vtkQuadric.h"
#include "vtkPlane.h"
#include "vtkSampleFunction.h"
#include "vtkCutter.h"
int main( int argc, char *argv[] )
{
  vtkQuadric *quadric=vtkQuadric::New();
  quadric->SetCoefficients(.5 ,1, .2, 0, .1, 0, 0, .2, 0, 0);

  vtkSampleFunction * data =vtkSampleFunction::New();
  data->SetSampleDimensions(30, 30, 30);
  data->SetImplicitFunction(quadric);

  vtkPlane *plane=vtkPlane::New();
   //# eval plane SetOrigin [[data GetOutput] GetCenter]
    plane->SetOrigin( 0, 0, .2);
    plane->SetNormal( -0.287, 0, 0.9579);

	vtkCutter *planeCut=vtkCutter::New();
    planeCut->SetInput(data->GetOutput());
    planeCut->SetCutFunction(plane);

	vtkPolyDataMapper *cutMapper=vtkPolyDataMapper::New();
    cutMapper->SetInput (planeCut->GetOutput());
//#    eval cutMapper SetScalarRange \
//#      [[[[data GetOutput] GetPointData] GetScalars] GetRange]
	vtkActor *cutActor=vtkActor::New();
    cutActor->SetMapper (cutMapper);
	//ren1 AddActor cutActor
  vtkRenderer *ren1= vtkRenderer::New();
  ren1->AddActor( cutActor );
  ren1->SetBackground( 0.1, 0.2, 0.4 );
  vtkRenderWindow *renWin = vtkRenderWindow::New();
  renWin->AddRenderer( ren1 );
  renWin->SetSize( 300, 300 );

  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(renWin);

  vtkInteractorStyleTrackballCamera *style =
    vtkInteractorStyleTrackballCamera::New();
  iren->SetInteractorStyle(style);

  iren->Initialize();
  iren->Start();

  cone->Delete();
  ren1->Delete();
  renWin->Delete();
  iren->Delete();
  style->Delete();

  return 0;
}




The following is my error:

--------------------Configuration: Cone5 - Win32 Debug--------------------
Compiling...
Cone5.cxx
C:\Documents and Settings\Srinivas\Desktop\step\Cone5.cxx(99) : error C2664: 
'SetInput' : cannot convert parameter 1 from 'class vtkImageData *' to 
'class vtkDataSet *'
        Types pointed to are unrelated; conversion requires 
reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

Cone5.exe - 1 error(s), 0 warning(s)

_________________________________________________________________
7000 classifieds 
http://www.sulekha.com/classifieds/cllist.aspx?nma=IN&ref=msn -Chennai, 
Mumbai, Hyderabad Bangalore.




More information about the vtkusers mailing list