[vtkusers] BoxWidget + VolumeMapper errors
dean.inglis at camris.ca
dean.inglis at camris.ca
Thu May 27 16:37:14 EDT 2004
David,
just to re-iterate, the original problem was:
box->GetPlanes(planes);
mapper->SetClippingPlanes(planes);
when planes is a vtkPlanes. So yes, this
can be simplified when vtkPlanes is behaving as
expected. Otherwise,
vtkAbstractMapper::SetPlanes(vtkPlanes*)
will still fail. Thanks for the clarifications.
Dean
> Also, Dean, note that as Mathieu said, you can simplify your code
> by just doing
>
> box->GetPlanes(planes);
> mapper->SetClippingPlanes(planes);
>
> Cheers,
> - David
>
>
> On Thu, 27 May 2004, Dean Inglis wrote:
>
> > 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
> > >
> >
> >
> >
> >
> > _______________________________________________
> > 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