osgEarth 2.1.1
Functions | Variables

anonymous_namespace{Controls.cpp} Namespace Reference

Functions

void calculateRotatedSize (float w, float h, float angle_rad, float &out_w, float &out_h)
void rot (float x, float y, const osg::Vec2f &c, float angle_rad, osg::Vec3f &out)

Variables

char * s_controlVertexShader = "} \n"
char * s_imageControlFragmentShader = "} \n"
char * s_labelControlFragmentShader = "} \n"

Function Documentation

void anonymous_namespace{Controls.cpp}::calculateRotatedSize ( float  w,
float  h,
float  angle_rad,
float &  out_w,
float &  out_h 
)

Definition at line 80 of file Controls.cpp.

    {
        float x1 = -w/2, x2 = w/2, x3 =  w/2, x4 = -w/2;
        float y1 =  h/2, y2 = h/2, y3 = -h/2, y4 = -h/2;

        float cosa = cos(angle_rad);
        float sina = sin(angle_rad);

        float
            x11 =  x1*cosa + y1*sina,
            y11 = -x1*sina + y1*cosa,
            x21 =  x2*cosa + y2*sina,
            y21 = -x2*sina + y2*cosa,
            x31 =  x3*cosa + y3*sina,
            y31 = -x3*sina + y3*cosa,
            x41 =  x4*cosa + y4*sina,
            y41 = -x4*sina + y3*cosa;

        float xmin = std::min(x11, std::min(x21, std::min(x31, x41)));
        float ymin = std::min(y11, std::min(y21, std::min(y31, y41)));

        float xmax = std::max(x11, std::max(x21, std::max(x31, x41)));
        float ymax = std::max(y11, std::max(y21, std::max(y31, y41)));

        out_w = xmax-xmin;
        out_h = ymax-ymin;
    }

Here is the caller graph for this function:

void anonymous_namespace{Controls.cpp}::rot ( float  x,
float  y,
const osg::Vec2f &  c,
float  angle_rad,
osg::Vec3f &  out 
)

Definition at line 108 of file Controls.cpp.

    {
        float cosa = cos(angle_rad);
        float sina = sin(angle_rad);
        out.x() = (c.x()-x)*cosa - (c.y()-y)*sina + c.x();
        out.y() = (c.y()-y)*cosa + (c.x()-x)*sina + c.y();
        out.z() = 0.0f;
    }

Here is the caller graph for this function:


Variable Documentation

char* anonymous_namespace{Controls.cpp}::s_controlVertexShader = "} \n"

Definition at line 45 of file Controls.cpp.

char* anonymous_namespace{Controls.cpp}::s_imageControlFragmentShader = "} \n"

Definition at line 53 of file Controls.cpp.

char* anonymous_namespace{Controls.cpp}::s_labelControlFragmentShader = "} \n"

Definition at line 64 of file Controls.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines