Re: [osg-users] [vpb] Get lat lon of a vertex within a CoordinateSystemNode
OK nevermind I figured everything out. I had been confusing global coordinates with world coordinates, global coordinates being the scene's coordinate system and world being the Earth's coordinates. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43985#43985 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [vpb] Get lat lon of a vertex within a CoordinateSystemNode
Hello, I have read in an ive terrain database created with the following command: osgdem --geocentric -d dted.geotiff --POLYGONAL --no-terrain-simplification -o terrain.osg What I want to do is find the lat lon of a given vertex within the coordinateSystemNode. I am able to read in the ive as a node and do a dynamic cast to a coordinateSystemNode. I also have a nodevisitor set up that is able to pull out the vertex values that I need. However, these vertex Vec3d values are in the local coordinate system of the node, not the world coordinates. I know by looking at the terrain.osg file that the structure of the coordinateSystemNode is as follows: CoordinateSystemNode - EllipsoidModel - MatrixTransform -- Matrix -- Geode ---Geometry ClusterCullingCallback PrimitiveSets 2 VertexArray NormalArray ColorBinding OVERALL ColorArray TexCoordArray I think I may have to somehow use the Matrix in the CoordinateSystemNode to get out the global xyz values from the vertex coordinates, then convert the global coordinates to lat lon using osg::EllipsoidModel::convertXYZToLatLongHeight Is this the correct method? Am I missing something that would make this process easier/more efficient? Thanks much. -Ethan P.S. Sorry for all the questions lately, not trying to spam the forum too hard, I try to spend at least a few hours trying to figure anything out on my own before posting here. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43944#43944 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [vpb] Get lat lon of a vertex within a CoordinateSystemNode
On 11/18/2011 9:23 AM, Ethan Fahy wrote: I think I may have to somehow use the Matrix in the CoordinateSystemNode to get out the global xyz values from the vertex coordinates, then convert the global coordinates to lat lon using osg::EllipsoidModel::convertXYZToLatLongHeight Is this the correct method? Am I missing something that would make this process easier/more efficient? Thanks much. I think you're on the right track. See: http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a01555.html#de8c48a2ff8f03b62cfab99b6ff5b27e and then you can use that with convertXYZToLatLongHeight. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. There is no Truth. There is only Perception. To Perceive is to Exist. - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [vpb] Get lat lon of a vertex within a CoordinateSystemNode
Chris 'Xenon' Hanson wrote: On 11/18/2011 9:23 AM, Ethan Fahy wrote: I think I may have to somehow use the Matrix in the CoordinateSystemNode to get out the global xyz values from the vertex coordinates, then convert the global coordinates to lat lon using osg::EllipsoidModel::convertXYZToLatLongHeight Is this the correct method? Am I missing something that would make this process easier/more efficient? Thanks much. I think you're on the right track. See: http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a01555.html#de8c48a2ff8f03b62cfab99b6ff5b27e and then you can use that with convertXYZToLatLongHeight. Thanks Chris, works like a charm! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43949#43949 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [vpb] Get lat lon of a vertex within a CoordinateSystemNode
Wait a sec I think I spoke too soon. I used [/code]osg::Matrixd transformMatrix = osg::computeLocalToWorld(this-getNodePath(),true); Code: to create a transform matrix to go from local to world coordinates, but what does world coordinates mean in this case? What if I've read in my ive terrain file but haven't attached it to any root? What I need is to be able to take a vertex coordinate and convert it to lat lon height or xyz with respect to the ellipsoid model. What will multiplying my transformMatrix by the xyz of the local vertices give me if my terrain node hasn't been attached to the root yet? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43952#43952 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org