Re: [osg-users] CoordinateSystemNode question about Local Coordinate Frame

2011-11-09 Thread J.P. Delport

Hi,

I think maybe computeLocalCoordinateFrame just assumes you want a 
coordinate frame at 0 height. The separate functions 
convertXYZToLatLongHeight [1] for going from ECEF to LLA and 
computeLocalToWorldTransformFromLatLongHeight work fine AFAIK.


You can also modify the transform so you have XYZ in the local 
coordinate frame line up with axes you expect.


Here's the code we use to create a local North, East, Down transform at 
a given LLA.


--8<--
osg::Matrixd getLocalToWorldTransformFromLatLongHeight(
const double lat_deg,
const double lon_deg,
const double alt_m)
{
osg::Matrixd localToWorld;
gEllipsoidModel_->computeLocalToWorldTransformFromLatLongHeight(
osg::DegreesToRadians(lat_deg), osg::DegreesToRadians(lon_deg), 
alt_m,

localToWorld);

// The coordinate system used by OSG is Z-up, Y-north, X-east
// rotate to ours of X-north, Y-east, Z-down.
osg::Matrixd makenorth;
makenorth.makeRotate(-osg::PI/2.0,osg::Vec3d(0,0,1));

osg::Matrixd makeup;
makeup.makeRotate(osg::PI,osg::Vec3d(1,0,0));

return makenorth * makeup * localToWorld;
}

--8<--

jp

[1] Note there are 3 coordinate systems involved, local XYZ, ECEF XYZ 
and LLA. The matrix from getLocalToWorldTransformFromLatLongHeight 
converts between ECEF and local XYZ.


On 08/11/2011 22:20, Scott Wasinger wrote:

Hi,

I have a task that will require placing a model of  launch vehicle in
orbit around the earth and I've been delving into the OSG library
code so I don't have to re-invent functionality that may already
exist.  Both the CoordinateSystemNode and the EllipsoidModel classes
are well defined and look very promising.  But I'm concerned about
how some code that computes the local coordinate frame.

in CoordinateSystemNode::computeLocalCoordinateFrame

Line # 45-61


the variable 'height' doesn't seem to be utilized.  Whatever value
was returned after calling this


Code:

_ellipsoidModel->convertXYZToLatLongHeight(position.x(),position.y(),position.z(),latitude,
longitude, height);




seems not to factor in the height when trying to compute the local to
world transform from Latitude, Longitude and Height.


Code:

_ellipsoidModel->computeLocalToWorldTransformFromLatLongHeight(latitude,
longitude, 0.0f, localToWorld);




Is this a possible bug or am I missing something important?

Thank you!!

Scott

-- Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43779#43779





___ osg-users mailing
list osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] CoordinateSystemNode question about Local Coordinate Frame

2011-11-08 Thread Torben Dannhauer
Hi Scott,

I used the conversion from XYZ to lat lon height quite often and it worked as 
expected.

Unfortunately I have currently no spare time to dive into the code to explain 
why...

Have you simply tried to use it? Does it work as expected or does this 
"height=0.0 anomaly" occure also in pratical use of teh code?

Cheers,
Torben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43789#43789





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] CoordinateSystemNode question about Local Coordinate Frame

2011-11-08 Thread Scott Wasinger
Hi,

I have a task that will require placing a model of  launch vehicle in orbit 
around the earth and I've been delving into the OSG library code so I don't 
have to re-invent functionality that may already exist.  Both the 
CoordinateSystemNode and the EllipsoidModel classes are well defined and look 
very promising.  But I'm concerned about how some code that computes the local 
coordinate frame.

in CoordinateSystemNode::computeLocalCoordinateFrame  

Line # 45-61


the variable 'height' doesn't seem to be utilized.  Whatever value was returned 
after calling this


Code:

_ellipsoidModel->convertXYZToLatLongHeight(position.x(),position.y(),position.z(),latitude,
 longitude, height);




seems not to factor in the height when trying to compute the local to world 
transform from Latitude, Longitude and Height. 


Code:

_ellipsoidModel->computeLocalToWorldTransformFromLatLongHeight(latitude, 
longitude, 0.0f, localToWorld);




Is this a possible bug or am I missing something important?

Thank you!!

Scott

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43779#43779





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org