osgEarth 2.1.1
Defines | Functions

/home/cube/sources/osgearth/src/osgEarthDrivers/engine_droam/CubeManifold.cpp File Reference

#include "CubeManifold"
#include <osgEarth/Cube>
Include dependency graph for CubeManifold.cpp:

Go to the source code of this file.

Defines

#define NEG_Y   0
#define POS_Y   1
#define NEG_X   2
#define POS_X   3
#define NEG_Z   4
#define POS_Z   5
#define LC   "[CubeManifold] "

Functions

static bool toLonLatRad (const osg::Vec3d &coord, osg::Vec3d &out_lonLat)

Define Documentation

#define LC   "[CubeManifold] "

Definition at line 29 of file CubeManifold.cpp.

#define NEG_X   2

Definition at line 24 of file CubeManifold.cpp.

#define NEG_Y   0

Definition at line 22 of file CubeManifold.cpp.

#define NEG_Z   4

Definition at line 26 of file CubeManifold.cpp.

#define POS_X   3

Definition at line 25 of file CubeManifold.cpp.

#define POS_Y   1

Definition at line 23 of file CubeManifold.cpp.

#define POS_Z   5

Definition at line 27 of file CubeManifold.cpp.


Function Documentation

static bool toLonLatRad ( const osg::Vec3d &  coord,
osg::Vec3d &  out_lonLat 
) [static]

Definition at line 302 of file CubeManifold.cpp.

{
    double lat, lon;

    // normalize all coordinates into the [0..1] range:
    double x = (1.0+coord.x())*0.5;
    double y = (1.0+coord.y())*0.5;
    double z = (1.0+coord.z())*0.5;

    // now convert into lat/long; this is different for each face:

    if ( coord.x() == 1.0 ) // positive X ( 0 <= lon <= 90, -45 <= lat <= 45 )
    {
        if ( !osgEarth::CubeUtils::faceCoordsToLatLon( y, z, 2, lat, lon ) )
            OE_WARN << LC << "+X: fc2ll failed" << std::endl;
    }
    else if ( coord.x() == -1.0 ) // negative X ( -180 <= lon <= -90, -45 <= lat <= 45 )
    {
        if ( !osgEarth::CubeUtils::faceCoordsToLatLon( 1.0-y, z, 0, lat, lon ) )
            OE_WARN << LC << "-X: fc2ll failed" << std::endl;
    }
    else if ( coord.y() == 1.0 ) // positive Y ( 90 <= lon <= 180, -45 <= lat <= 45 )
    {
        if ( !osgEarth::CubeUtils::faceCoordsToLatLon( 1.0-x, z, 3, lat, lon ) )
            OE_WARN << LC << "+Y: fc2ll failed" << std::endl;
    }
    else if ( coord.y() == -1.0 ) // negative Y ( -90 <= lon <= 0, -45 <= lat <= 45 )
    {
        if ( !osgEarth::CubeUtils::faceCoordsToLatLon( x, z, 1, lat, lon ) )
            OE_WARN << LC << "-Y: fc2ll failed" << std::endl;
    }
    else if ( coord.z() == 1.0 ) // positive Z ( -180 <= lon < 180, 45 <= lat <= 90 )
    {
        if ( !osgEarth::CubeUtils::faceCoordsToLatLon( 1.0-y, x, 4, lat, lon ) )
            OE_WARN << LC << "+Z: fc2ll failed" << std::endl;
    }
    else //if ( coord.z() == -1.0 ) // negative Z ( -180 <= lon < 180, -90 <= lat <= -45 )
    {
        if ( !osgEarth::CubeUtils::faceCoordsToLatLon( x, 1.0-y, 5, lat, lon ) )
            OE_WARN << LC << "-Z: fc2ll failed" << std::endl;
    }

    out_lonLat.x() = osg::DegreesToRadians( lon );
    out_lonLat.y() = osg::DegreesToRadians( lat );
    out_lonLat.z() = 0.0;

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines