How do I use this osgEarth::GeoPoint::createLocalToworld function?

classic Classic list List threaded Threaded
5 messages Options
Mirro187 Mirro187
Reply | Threaded
Open this post in threaded view
|

How do I use this osgEarth::GeoPoint::createLocalToworld function?

This post was updated on .
CONTENTS DELETED
The author has deleted this message.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How do I use this osgEarth::GeoPoint::createLocalToworld function?

What you are trying to do?
Glenn Waldron / Pelican Mapping
Mirro187 Mirro187
Reply | Threaded
Open this post in threaded view
|

Re: How do I use this osgEarth::GeoPoint::createLocalToworld function?

This post was updated on .
   Thank you for your question and answer.
   why the osg::AutoTransform disappears after using the set setAutoRotateMode method to be true.

    std::string timesFont("fonts/arial.ttf");

    osgText::Text* text = new osgText::Text;
    text->setCharacterSize(characterSize);
    text->setText(message);
    text->setFont(timesFont);
    text->setAlignment(osgText::Text::CENTER_CENTER);

    osg::Geode* geode = new osg::Geode;
    geode->addDrawable(text);
    geode->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

    osg::AutoTransform* at = new osg::AutoTransform;
    at->addChild(geode);

    at->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);
    at->setAutoScaleToScreen(true);
    at->setMinimumScale(minScale);
    at->setMaximumScale(maxScale);
    at->setPosition(position);
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: How do I use this osgEarth::GeoPoint::createLocalToworld function?

What does this have to do with GeoPoint::createLocalToworld?

This looks like an OSG question; I suggest you ask over on the OSG mailing list.
https://groups.google.com/g/osg-users
Glenn Waldron / Pelican Mapping
Mirro187 Mirro187
Reply | Threaded
Open this post in threaded view
|

Re: How do I use this osgEarth::GeoPoint::createLocalToworld function?

Hello, when do you use this createWorldToLocal?
In the following example, the world coordinates from latitude and longitude multiplied by the createWorldToLocal yield 0.

osg::Matrix matWorld, matLocal;
//
osgEarth::GeoPoint mapPoint(_pMapNode->getMap()->getSRS()->getGeographicSRS(), 119.60499600000000, 34.565052999999999,1.0,ALTMODE_RELATIVE);
//
mapPoint.createLocalToWorld(matWorld);
mapPoint.createWorldToLocal(matLocal);
//
osg::Vec3d worldPos(0, 0, 0);
const osgEarth::SpatialReference* latLong = _pMapNode->getMap()->getSRS()->getGeographicSRS();
latLong->transformToWorld(osg::Vec3d(119.60499600000000, 34.565052999999999, 1.0), worldPos);
worldPos = worldPos * matLocal;