[osg-users] obj file coordinate is different from what osgearth display

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Wed Apr 29 01:09:24 PDT 2020


So what I have done in reading a point cloud from a .ply file with point 
coordinate in WGS84 (Lat-Long-Height), is that I iterate over each vertex 
and convert the coordinates into ECEF format given the functions from 
osgEarth:

for(uint elementIdx = 0; elementIdx < vertArray->getNumElements(); ++elementIdx)
{
      //--- read current vertex from array

osg::Vec3d llhVert = static_cast<osg::Vec3>((*vertArray)[elementIdx]);


      //--- initialize geopoint
      osgEarth::GeoPoint geoPoint;
      geoPoint = osgEarth::GeoPoint(osgEarth::SpatialReference::get("epsg:4326", "egm96"),
                                    llhVert.x(), llhVert.y(), llhVert.z(),
                                    osgEarth::ALTMODE_ABSOLUTE);

      //--- convert geopoint into ecef point
      osg::Vec3d ecefVert;
      geoPoint.toWorld(ecefVert);

      //--- save vertex
      (*vertArray)[elementIdx] = ecefVert;

}




Am Mittwoch, 29. April 2020 05:49:35 UTC+2 schrieb wu:
>
> Can you provide some ideas? I am a novice for osgearth. I use readNodeFile 
> fnction to read obj  file and display (wgs84), then use writeNodeFile to 
> write obj file then display in cesiumlab.
>
> On Tuesday, April 28, 2020 at 7:02:27 PM UTC+8, Boitumelo Ruf wrote:
>>
>> Yes, but internally it will transform the wgs84 coordinates to ECEF in 
>> order to place them inside the eucledian coordinate system of osg. Look at: 
>> http://forum.osgearth.org/LIDAR-data-visualization-td7592224.html
>>
>> Am Dienstag, 28. April 2020 12:29:01 UTC+2 schrieb wu:
>>>
>>> my osgearth coordinate system use the wgs84 not ECEF
>>>
>>> On Tuesday, April 28, 2020 at 5:12:29 PM UTC+8, Boitumelo Ruf wrote:
>>>>
>>>> Have you checked the osgEarth forum: http://forum.osgearth.org/
>>>>
>>>> osgEarth uses an Earth-Centered-Earth-Fixed (ECEF) eucledian coordinate 
>>>> system. Maybe you would need to transform the coordinates inside your .obj 
>>>> file first.
>>>>
>>>> Am Dienstag, 28. April 2020 11:03:38 UTC+2 schrieb wu:
>>>>>
>>>>> obj file coordinate is different from what osgearth display!
>>>>> i use osgearth  display my pipe (wgs84)
>>>>> pipe display correct,but  obj Exported is Incorrect。I checked some 
>>>>> information but found no reason!
>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/f89a9df4-79d4-4124-a0db-191667bd4251%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200429/20dccf95/attachment.html>


More information about the osg-users mailing list