[vtkusers] vtkBoxWidget GetPlane Function Bug ?

Eric E. Monson emonson at cs.duke.edu
Mon Aug 9 09:21:33 EDT 2010


Hey Naresh,

I don't know if this is your problem, but the documentation for vtkPlanes (and looking at the source code) says that GetPlane(int i) will always return a pointer to the same vtkPlane object (internal to vtkBoxWidget):

http://www.vtk.org/doc/nightly/html/classvtkPlanes.html

"Create and return a pointer to a vtkPlane object at the ith position. Asking for a plane outside the allowable range returns NULL. This method always returns the same object. Use GetPlane(int i, vtkPlane plane) instead"

So, I would try using the other GetPlane method to make sure you are getting different planes each time. 

This shouldn't give you random data, though, so maybe something just isn't initialized by the time you are accessing it... Did you follow the examples for vtkBoxWidget for initializing everything? (something like this from Examples and Tests in http://www.vtk.org/doc/nightly/html/classvtkBoxWidget.html)

vtkBoxWidget *boxWidget = vtkBoxWidget::New();
boxWidget->SetInteractor(iren);
boxWidget->SetPlaceFactor(1.25);
boxWidget->SetProp3D(actor);
(or, boxWidget->SetInput(filter->GetOutput()); )
boxWidget->PlaceWidget();
vtkMyCallback *callback = vtkMyCallback::New();
boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);
boxWidget->On();

Hope this helps,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Aug 9, 2010, at 8:53 AM, naresh wrote:

> Hi
> 
> I have problem with vtkBoxwidget->GetPlane function. It returns the radom data of normal values. Is these bug or i am doing anything wrong ?
> 
> Here is code of it. I tried to debug it . In first time and second time values changes as radomly in normal value.
> 
> 
> for(int i=0; i<2; i++)
> {
> // Get the planes
> m_BoxWidget->GetPlanes(m_Planes);
> 
> // Access by index
> m_PlaneMinX = m_Planes->GetPlane(0);
> m_PlaneMaxX = m_Planes->GetPlane(1);
> }
> 
> 
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list