Focal Point equal to Viewpoint coordinate?

classic Classic list List threaded Threaded
2 messages Options
aozdin aozdin
Reply | Threaded
Open this post in threaded view

Focal Point equal to Viewpoint coordinate?

Hello all,

After I set viewpoint coordinates, I want to find where the camera is looking at on the ground. That point is focal point as I attached it in the image and read from osgEarth forum.
After setting viewpoint coordinates, I print the focal point coordinates. And I saw that focal point coordinates is equal to coordinates of viewpoint. Why?

I set viewpoint coordinates and print focal point as in the source code below:

osgEarth::Config c;

c.add("x", longitude_deg);
c.add("y", latitude_deg);
c.add("z", altitude_meter);
c.add("heading", trueheading_deg);
c.add("pitch", -30.0 );

manipulator->setViewpoint( Viewpoint(c), 0.0 );

std::cout<< "x: " << manipulator->getViewpoint().focalPoint().value().x()<<std::endl;
std::cout<< "y: " << manipulator->getViewpoint().focalPoint().value().y()<<std::endl;
std::cout<< "z: " << manipulator->getViewpoint().focalPoint().value().z()<<std::endl;

Best regards,
<nabble_a href="focalPoint.PNG">focalPoint.PNG
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view

Re: Focal Point equal to Viewpoint coordinate?

That is correct - the "focalPoint" is the point you are looking at. There is no function to retrieve the camera position from the Viewpoint, but you can get it from the view matrix...


(By the way, avoid using the osgEarth::Config construct directly. Use the Viewpoint API instead. Config is an internal construct.)
Glenn Waldron / Pelican Mapping