[vtkusers] vtkImplicitDataSet

Andres Barrera andresba at hotmail.com
Wed Sep 4 15:57:23 EDT 2002


Dear List,

  How does "vtkImplicitDataSet" works? I couldn't figure it out from 
previous e-mails in the list....

  The following code works if I use a "vtkSphere" for clipping, but not when 
I use an "vtkSphere" that is what I really want.

  Thank you all in advance.

         Andres

====   CODE  ==========
// (SIP)
   vtkSTLReader  * sr = vtkSTLReader::New();
       sr->SetFileName( FILENAME );

   vtkPolyDataMapper *stlMapper = vtkPolyDataMapper::New();
       stlMapper->SetInput(sr->GetOutput());

   vtkActor * stlActor       = vtkActor ::New();
       stlActor->SetMapper(stlMapper);

    //Add actor....
    renGeneral->AddActor( stlActor);


   vtkImplicitDataSet* ImplicitDataSet = vtkImplicitDataSet::New();
       ImplicitDataSet->SetDataSet( sr->GetOutput() );

   vtkSphereSource * myBall = vtkSphereSource::New();
       myBall->SetCenter(center);
       myBall->SetRadius(radious);
       myBall->SetThetaResolution(20);
       myBall->SetPhiResolution(20);


   //clipping....
    vtkClipPolyData *myClipper     = vtkClipPolyData::New();
        myClipper->SetInput       ( myBall->GetOutput()   );
        //myClipper->SetClipFunction( GLOBALsphere          );
		myClipper->SetClipFunction( ImplicitDataSet       );
        myClipper->GenerateClipScalarsOn();
        myClipper->GenerateClippedOutputOn();
        myClipper->SetValue( 0.5);

    vtkPolyDataMapper *clipMapper = vtkPolyDataMapper::New();
        clipMapper->SetInput(myClipper->GetOutput());
        clipMapper->ScalarVisibilityOff();


    vtkActor      *CLIPActor = vtkActor::New();
        CLIPActor->SetMapper( clipMapper);
        CLIPActor->GetProperty()->SetColor(0.3, 0.3, 0);

   //The clipped part of the INPUT is rendered wireframe.
    vtkPolyDataMapper *restMapper = vtkPolyDataMapper::New();
       restMapper->SetInput(myClipper->GetClippedOutput());
       restMapper->ScalarVisibilityOff();

    vtkActor        *RESTActor =  vtkActor::New();
        RESTActor->SetMapper( restMapper);
        RESTActor->GetProperty()->SetRepresentationToWireframe();
        RESTActor->GetProperty()->SetColor(0.3, 0.7, 0.7);


    //Add actor....
    renGeneral->AddActor( CLIPActor);
    renGeneral->AddActor( RESTActor);

    // (SIP)



_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com




More information about the vtkusers mailing list