[vtkusers] why SetImplicitionFunction is not a member of vtkSampleFunction?

german german_leung at hotmail.com
Mon Mar 5 22:00:34 EST 2001


Dear all vtk user:
I try to convert the icecream.tcl to C++!  My code was shoe in below:--
void main()
{
 //create a rendering windows and render
 vtkRenderer*ren=vtkRenderer::New();
 vtkRenderWindow*renWindow=vtkRenderWindow::New();
 renWindow->AddRenderer(ren);
 renWindow->SetSize(500,500);

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

 //create implicit function primitives
 vtkSphere*iceCream=vtkSphere::New();
 iceCream->SetRadius(0.5);
 iceCream->SetCenter(1.333, 0, 0);
 vtkSphere*bite=vtkSphere::New();
 bite->SetRadius(0.25);
 bite->SetCenter(1.5, 0, 0.5);

 //Set Operation
 vtkImplicitBoolean*theCream=vtkImplicitBoolean::New();
 theCream->SetOperationTypeToDifference();
 theCream->AddFunction(iceCream);
 theCream->AddFunction(bite);

 //iso-surface to create geometry
 vtkSampleFunction*theCreamSample=vtkSampleFunction::New(); 
 theCreamSample->SetImplicitionFunction(theCream);
 theCreamSample->SetModelBounds(-1,1.5,-1.25,1.25,-1.25,1.25);
 theCreamSample->SetSampleDimensions(60,60,60);
 theCreamSample->ComputeNormalsOff(); 

 //Generate implicit surface
 vtkContourFilter*theCreamSurface=vtkContourFilter::New();
 theCreamSurface->SetInput(theCreamSample->GetOutput());
 theCreamSurface->SetValue(0, 0.0);
// range[0]=1.0;range[1]=6.0;
// theCreamSurface->GenerateValues(3,range);

 //Map theCreamSurface
 vtkPolyDataMapper*creamMapper=vtkPolyDataMapper::New();
 creamMapper->SetInput(theCreamSurface->GetOutput());
 creamMapper->ScalarVisibilityOff();

 //Add actor into the scene
 vtkActor*theCreamSurfaceActor=vtkActor::New();
 theCreamSurfaceActor->SetMapper(creamMapper);
 ren->AddActor(theCreamSurfaceActor);

 //draw the result scene
 renWindow->Render();
 ren->SetBackground(0.1, 0.2, 0.4);
 iren->Start();
}

When I try to build the program, but the error show " SetImplicitionFunction is not a member of vtkSampleFunction"

But in icecream.tcl:--
the code show this: 
vtkImplicitBoolean theCream
    theCream SetOperationTypeToDifference
    theCream AddFunction iceCream
    theCream AddFunction bite

# iso-surface to create geometry
vtkSampleFunction theConeSample
    theConeSample SetImplicitFunction theCone

What is the difference between the code in C++ and tcl?  Why the program can run in tcl but not in C++??

Please help!  Because I want try some vtkImplicitBoolean in C++!

Can anyone sent me some idea to solve this problems?

Best regards,
German Leung
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010306/0117b98c/attachment.htm>


More information about the vtkusers mailing list