[vtkusers] problems with setting camera distance

Liam Kurmos quantum.leaf at googlemail.com
Mon Jan 25 12:26:46 EST 2010


Many thanks to both of you for clearing that up.
It all makes sense now. Checking back with the documentation I see i
should have read it more carefully.

thanks for your help,

Liam


On Mon, Jan 25, 2010 at 4:36 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi Liam,
>
> The SetDistance() methods works by changing the position of the
> FocalPoint, while keeping the Position at the same place.  The Dolly()
> method moves the Position, but it doesn't take a distance as an
> argument.  Instead, it sets the new distance by dividing the current
> distance by the "dolly" value.
>
> When I use the vtkCamera, I prefer to simply use SetFocalPoint,
> SetPosition, and SetViewUp.  Even if it means adding a bit of math to
> my code.  By doing this, I avoid the confusion about what all those
> other methods are actually doing.
>
>    David
>
>
> On Mon, Jan 25, 2010 at 9:23 AM, Liam Kurmos
> <quantum.leaf at googlemail.com> wrote:
>> Hi,
>>
>> I'm still getting to grips with vtk. Building up a picture of how to
>> use it from the books and examples.
>>
>> I have a vtkImageData which I initialise with gaussian data, and
>> render a contour taken with marching cubes. I've been using
>> vtkCamera.Azimuth() and vtkCamera.Elevevation() to control the viewing
>> angle.
>>
>> Now i want to control the distance from the focal point. From the
>> doxygen i thought this would be simple using setDistance/Dolly but i
>> can't get it to work as expected.
>>
>> I've been experimenting with code like:
>>
>> ren1->AddActor(contourActor);
>>    vtkCamera* cam1=vtkCamera::New();
>>    cam1->SetFocalPoint(0,0,0);
>>    cam1->SetDistance(10);
>>    cam1->Dolly(-30);
>>    ren1->SetActiveCamera(cam1);
>>    //ren1->ResetCamera();
>>    cam1->SetDistance(10);
>>    //ren1->GetActiveCamera()->Dolly(200);
>>    cout<<"dist is "<<ren1->GetActiveCamera()->GetDistance()<<endl;
>>
>>
>> I find that SetDistance changes the value report by GetDistance, but
>> not what is rendered on the screen. Doing a negative Dolly has no
>> effect, Doing a positive dolly affect the reported distance but not
>> what is rendered on the screen. Doing a ResetCamera() affects the
>> reported distance and changes what is rendered on the screen.
>>
>> I've started using SetPosition() and this seems to work as i would expect.
>>
>> Is VtkCamera::setDistance() broken, or am I using it incorrectly?
>>
>> regards,
>>
>> Liam
>> _______________________________________________
>> 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