コード例 #1
0
ファイル: astronomy.cpp プロジェクト: helsing72/osghimmel
const osg::Matrixf Astronomy::equToHorTransform(
    const t_aTime &aTime
,   const float latitude
,   const float longitude) const
{
    const t_julianDay T(jCenturiesSinceSE(jd(aTime)));
    const float s = siderealTime(aTime);

    return osg::Matrixf::scale(-1, 1, 1)
        * osg::Matrixf::rotate( _rad(latitude)  - _PI_2, 1, 0, 0)
        * osg::Matrixf::rotate(-_rad(s + longitude)    , 0, 0, 1)
        // precession as suggested in (Jensen et al. 2001)
        * osg::Matrixf::rotate( 0.01118 * T, 0, 0, 1)
        * osg::Matrixf::rotate(-0.00972 * T, 1, 0, 0)
        * osg::Matrixf::rotate( 0.01118 * T, 0, 0, 1);
}
コード例 #2
0
ファイル: starsgeode.cpp プロジェクト: 3dcl/osghimmel
void StarsGeode::update(const Himmel &himmel)
{
    // TODO: starmap and planets also require this ... - find better place
    const float fov = himmel.getCameraFovHint();
    const float height = himmel.getViewSizeHeightHint();

    //u_q->set(static_cast<float>(tan(_rad(fov / 2)) / (height * 0.5)));
    u_q->set(static_cast<float>(4.0 * tan(_rad(fov * 0.5)) / height));

    u_R->set(himmel.astro()->getEquToHorTransform());
}
コード例 #3
0
ファイル: astronomy.cpp プロジェクト: helsing72/osghimmel
const osg::Matrixf Astronomy::moonOrientation(
    const t_aTime &aTime
,   const float latitude
,   const float longitude) const
{    
    const t_julianDay t(jd(aTime));

    t_longf l, b;
    Moon::opticalLibrations(t, l, b);

    const osg::Matrixf libLat = osg::Matrixf::rotate(_rad(b), -1, 0, 0);
    const osg::Matrixf libLon = osg::Matrixf::rotate(_rad(l),  0, 1, 0);

    const float a = _rad(Moon::positionAngleOfAxis(t));
    const float p = _rad(Moon::parallacticAngle(aTime, latitude, longitude));

    const osg::Matrixf zenith = osg::Matrixf::rotate(p - a, 0, 0, 1);

    // finalOrientationWithLibrations
    const osg::Matrixf R(libLat * libLon * zenith);

    return R;
}