[vtkusers] Dolly Event for vtkInteractorTrackballCamera

Kerry Loux louxkr at gmail.com
Wed Jan 14 19:40:13 EST 2009


I have to override both Dolly(double) and Dolly(void).  Dolly(void) is
identical to the original found in vtkInteractorStyleTrackballCamera, but is
included because I have calls to Dolly(void) in my subclass, and
Dolly(double) is the one that actually calls camera->Dolly() (Dolly(double)
is called from Dolly(void)).

Anyway, I can do this:

  double fpx, fpy, fpz, fcx, fcy, fcz;
  camera->GetFocalPoint(fpx, fpy, fpz);
  camera->GetPosition(fcx, fcy, fcz);
  VECTOR Position(fcx, fcy, fcz);
  VECTOR FocalPoint(fpx, fpy, fpz);
  VECTOR NewFocalPoint = Position + (FocalPoint - Position).Normalize() *
30.0;
  camera->SetFocalPoint(NewFocalPoint.X, NewFocalPoint.Y, NewFocalPoint.Z);
  camera->Dolly(factor);

This makes dolly work OK, but now the focal point is wrong and Pan() and
Rotate() get weird as a result.  I can recalculate the actual focal point
before I leave my function maybe...

Has anyone else tried to do this?

On Tue, Jan 13, 2009 at 9:54 PM, 王君臣 <wangjunchen at gmail.com> wrote:

> THE OVERRIDED VIRTUAL FUNCTION MUST BE THE SAME SIGNATURE WITH THE
> CORRESPONDING FUNCTION IN ITS SUPER CLASS.
>
> IN YOUR CASE, IN THE SUPER CLASS IS Dolly(double), SO
> IN YOUR DERIVED CLASS, IT MUST BE Dolly(double), CAN NOT BE Dolly(void)
>
>
>
> 2009/1/14 Kerry Loux <louxkr at gmail.com>
>
>> Hello,
>>
>> I have an interactor derived from vtkInteractorTrackballCamera.  I am
>> interested in changing the dolly behavior so that instead of moving the
>> camera some fraction of the distance to the focal point, the camera is moved
>> a constant distance with every call to Dolly().  As a test, I copied the
>> Dolly(double) function from vtkInteractorTrackballCamera to my derived class
>> as the Dolly(void) and replaced "factor" with 10.0.  This did not change the
>> behavior.  I also tried changing the call to the camera's Dolly() function
>> to camera->Dolly(10.0) and camera(camera->GetDistance() * 10.0) with no
>> avail.  Am I going to have to create my own subclass of vtkCamera?  It seems
>> that there has to be an easier way.  Any ideas?
>>
>> Thanks,
>>
>> Kerry
>>
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
>
> --
> 王君臣
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090114/375760e1/attachment.htm>


More information about the vtkusers mailing list