[osg-users] Zoom in to special area and special object

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Wed Feb 22 01:16:44 PST 2017


Hi Daven
> Hello, everyone!
> I hope you are doing well.
> Using osgEarth, I think that mouse interface is very good.
> While mouse right dragging, we can zoom in or zoom out smoothly.
> If we double click on terrain, camera will move smoothly as flying and zoom in.
>
> 1. I’m trying to zoom in to special rectangle area by mouse right drag & drop.
>         - Dash lined rectangle should be drawn while mouse right dragging
>         - When mouse right drop, the rectangle area of the scene should be done zoom in
>      Please find my attached image. You can understand at first sight.
>
> 2. I’m trying to zoom in to terrain and to special object (such as box, sphere, polygon, line, 3ds, obj...) by mouse left double click.

You need to calculate the FoV angles in both cases based on your camera 
position and the size of the object in both cases*. If you need to 
combine it with flying there I'd interpolate between the current FoV and 
the new one while moving towards the object.

*Basically you can think of a triangle with the height being your 
distance to the object and the base length being on of your object's 
dimensions in the projection. Use trigonometry and figure out the angles 
you need to put in to your projection.

Cheers
Sebastian
>
> I have just read about 800 posts about camera zoom on forum.osgearth.org but I have not found a solution.
> How can I do that? Please teach me.
> Thanks for your time.
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=70304#70304
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list