[vtkusers] BoxWidget + VolumeMapper errors
Dean Inglis
dean.inglis at camris.ca
Thu May 27 14:36:14 EDT 2004
Okay, here is what works (not elegant but hey!)
<snip>
virtual void Execute(vtkObject *caller, unsigned long, void*)
{
vtkBoxWidget *box = reinterpret_cast<vtkBoxWidget*>(caller);
box->GetPlanes( planes );
mapper->RemoveAllClippingPlanes();
for (int i = 0; i<planes->GetNumberOfPlanes(); i++ )
{
vtkPlane* newplane = vtkPlane::New();
newplane->SetOrigin( planes->GetPlane(i)->GetOrigin() );
newplane->SetNormal( planes->GetPlane(i)->GetNormal() );
mapper->AddClippingPlane( newplane );
newplane->Delete();
}
}
<snip>
So, I think vtkPlanes needs udpated documentation/cautionary warning
and perhaps vtkAbstractMapper should be modified?
Dean
> why don't you simply use:
>void vtkAbstractMapper::SetClippingPlanes( vtkPlanes * planes )
> This seems to be much easier to use, right ?
>HTH
>Mathieu
dean.inglis at camris.ca wrote:
> I am trying to use vtkBoxWidget with a callback to send its vtkPlanes
> to a vtkVolumeMapper as in
> VTK/Examples/GUI/Tcl/VolumeRenderWithBoxWidget.tcl
> Apparently, I should be passing in a vtkPlaneCollection, so I tried
> modifying my callback:
>
> class vtkBWCallback : public vtkCommand
> {
> public:
> static vtkBWCallback *New()
> { return new vtkBWCallback; }
>
> virtual void Execute(vtkObject *caller, unsigned long, void*)
> {
> vtkBoxWidget *box = reinterpret_cast<vtkBoxWidget*>(caller);
> box->GetPlanes( planes);
> collection->RemoveAllItems();
> for (int i = 0; i < planes->GetNumberOfPlanes(); i++)
> {
> collection->AddItem( planes->GetPlane(i) );
> }
> mapper->SetClippingPlanes( collection );
> }
> vtkBWCallback():planes(0),mapper(0),pc(0){};
>
> vtkPlanes* planes;
> vtkPlaneCollection* collection;
> vtkVolumeTextureMapper2D* mapper;
> };
>
> no luck!
>
> I only get one plane acting as a clipping plane in both my .cxx app
> and in the above VTK tcl example. The plane with unit normal
> originally in the +z direction is the only valid plane.
> Can anyone else verify this error? This is seen on two builds:
>
> 1) Borland C++ Builder vers. 5 , Win 2k Pro, Pentium 4,
> NVIDIA GeForce4 Ti 4400, driver 5.3.0.3, CMake 2.0.0, latest VTK cvs
>
> 2) Borland C++ Builder vers. 6 , Win 2k Pro, Pentium 4 mobile,
> NVIDIA Quadro4 500 GoGL, driver 2.9.4.0, CMake 2.0.0, latest VTK cvs
>
> Dean
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list