How to rotate a rectangle based on yaw-pitch-roll

classic Classic list List threaded Threaded
6 messages Options
davidip davidip
Reply | Threaded
Open this post in threaded view
|

How to rotate a rectangle based on yaw-pitch-roll

Hi osgEarth friends,

I was able to display a rectangle on the earth surface based on a position specified by its latitude/longitude/altitude. The way I did it is to use GeometryFactory's createRectangle method, provide a Style, create a Feature based on the rectangle geometry and the style with CLAMP_TO_TERRAIN, then make a FeatrueNode and put the node in a Group.

The application need to consider the orientation factor. How can I rotate this rectangle if I have been provided by the some yaw, pitch, and roll values, for examples, from airplane and camera?

Thanks for helping me here.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How to rotate a rectangle based on yaw-pitch-roll

David,
You might have better luck under a LocalGeometryNode (versus a FeatureNode). LGN renders your geometry in a local tangent plane, and lets you set the local offset, rotation and scale relative to the object's position.
Glenn Waldron / Pelican Mapping
davidip davidip
Reply | Threaded
Open this post in threaded view
|

Re: How to rotate a rectangle based on yaw-pitch-roll

Glenn,

Thank you for your reply. I appreciate it. It's great that LGN can do local offset, rotation and scale relative to the object's position. But I could not find any sample applications in the package that uses LGN. I am new to osgEarth and still learning. Can you give me more information (document, sample code, etc.) if possible to get me going please?

Another question is how to find the elevation (assume it means the distance between an object and the earth terrain surface) of a point with a known lat/long and altitude?
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How to rotate a rectangle based on yaw-pitch-roll

You can query the terrain elevation under a point with the Terrain interface:

   MapNode->getTerrain()->getHeight(....)
Glenn Waldron / Pelican Mapping
davidip davidip
Reply | Threaded
Open this post in threaded view
|

Re: How to rotate a rectangle based on yaw-pitch-roll

Glenn,
Thank you for your input. I am reading a post on how to use LocalGeometryNode (http://forum.osgearth.org/How-to-use-LocalGeometryNode-td7579170.html). I can follow the code and draw a rectangle. Thanks to Hartwig and you. But I have a question about the unit of the coordinates shown in the following code. What do these number stand for?
vertexArrayPtr->push_back(osg::Vec3( 0,40,0));
vertexArrayPtr->push_back(osg::Vec3(60,40,0));
vertexArrayPtr->push_back(osg::Vec3(60,60,0));
vertexArrayPtr->push_back(osg::Vec3( 0,60,0));
Thanks.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How to rotate a rectangle based on yaw-pitch-roll

They are meters, in the x,y,z axes, relative to the local origin (the position of the tangent plane on the earth).
Glenn Waldron / Pelican Mapping