[vtkusers] reg sphereWidget behavior

somesh somesh.bbt at gmail.com
Fri Mar 12 14:19:36 EST 2010


Hi,
 I use a sphere widget in my application, where a user can drag the sphere
around and at the end I do a "pick point" on the surface based on the end
location of the sphere.
On end interaction event, I get the mouse location and use that to pick
point.
For example this is what I do in my callback function:

 int* pos1 = this->renderWindowInteractor->GetEventPosition();
 picker->Pick(pos1[0], pos1[1], 0, this->renderer);


The problem is that the location of the sphere is not exactly under the
mouse while dragging but offset by some variable amount.
Is there any way where the sphere always is under the mouse while dragging
it ?


The is my code where I call the callback:

   sphereWidgetReam = vtkSphereWidget::New();
   sphereWidgetReam->SetInteractor(this->iren);

    sphereCallbackReam = SphereCallback::New();
    sphereCallbackReam->SetRenderer(this->aRenderer);

    sphereCallbackReam->SetInteractor(this->iren);

sphereWidgetReam->AddObserver(vtkCommand::EndInteractionEvent,sphereCallbackReam);
    sphereWidgetReam->GetSphereProperty()->SetColor(0,1,0);
    sphereWidgetReam->GetSphereProperty()->SetOpacity(1);
    sphereWidgetReam->SetRadius(3);
    sphereWidgetReam->TranslationOn();
    sphereWidgetReam->ScaleOff();


Thanks,
Somi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100312/eded5d56/attachment.htm>


More information about the vtkusers mailing list