[vtkusers] vtkBoxWidget Clip vs Scale

C C cclist at gmail.com
Thu Dec 8 16:38:58 EST 2005


How can we make a vtkBoxWidget clip its data, rather than scale?

My approach was to:
   1) comment out the scale transform within GetTransform()
   2) use SetClippingPlanes() within my BoxWidget callback (get the
widget's planes and set as my volume mapper's clipping planes)

This *almost* works, but causes the data to RECENTER on each clip.  I
require the position of the volume to remain absolute during clipping.
 If you are familiar with vtkBoxWidgets I would appreciate some
guidance!

a snippet from the callback function is provided below.  This is
modelled after Step6 from the vtkTutorial:
VTK/Examples/Tutorial/Step6/cxx/Cone6.cxx

/////////////////////////////////////
vtkTransform *t = vtkTransform::New();
boxWidget->GetTransform(t);     //get the current transform from the boxwidget
boxWidget->GetProp3D()->SetUserTransform(t);  //apply this transform
to the box's prop (ie our volume)
t->Delete();   //delete transform after applying it
boxWidget->GetPlanes(planes);       //get our widget's planes
mapper->SetClippingPlanes(planes);   //and clip our data's mapper with it
////////////////////////////////////

( as the names may imply, boxWidget is my vtkBoxWidget, planes is a
vtkPlanes object, and mapper is a vtkVolumeTextureMapper3D of the
dataset )

thanks!



More information about the vtkusers mailing list