[vtkusers] vtkBoxWidget GetPlane Function Bug ?

naresh naresh at winner.co.in
Mon Aug 9 09:29:28 EDT 2010


Dear Eric

You are right . I am sorry for saying radom data rather i should say it 
returns same data as last one.  I tried to debug it and check the two 
pointer of vtkPlane . In stack both become same at last. So i think it 
points same address .

So what would be the solution  do i copy the value assining to new address 
everytime ?




----- Original Message ----- 
From: "Eric E. Monson" <emonson at cs.duke.edu>
To: "naresh" <naresh at winner.co.in>
Cc: <vtkusers at vtk.org>
Sent: Monday, August 09, 2010 6:51 PM
Subject: Re: [vtkusers] vtkBoxWidget GetPlane Function Bug ?


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