Esempio n. 1
0
void QuaternionTest::testEuler()
{
    QFETCH( qreal, pitch );
    QFETCH( qreal, yaw );
    QFETCH( qreal, roll );

    const Quaternion quat = Quaternion::fromEuler( pitch * DEG2RAD, yaw * DEG2RAD, roll * DEG2RAD );

    QFUZZYCOMPARE( quat.pitch() * RAD2DEG, pitch, 0.0000001 );
    QFUZZYCOMPARE( quat.yaw()   * RAD2DEG, yaw,   0.0000001 );
    QFUZZYCOMPARE( quat.roll()  * RAD2DEG, roll,  0.0000001 );
}
Esempio n. 2
0
void StereographicProjectionTest::screenCoordinatesOfCenter()
{
    QFETCH( QPoint, screenCoordinates );
    QFETCH( GeoDataCoordinates, expected );

    ViewportParams viewport;
    viewport.setProjection( Stereographic );
    viewport.setRadius( 180 / 4 ); // for easy mapping of lon <-> x
    viewport.setSize( QSize( 20, 20 ) );
    viewport.centerOn( 0 * DEG2RAD, 90 * DEG2RAD );

    {
        qreal lon, lat;
        const bool retval = viewport.geoCoordinates( screenCoordinates.x(), screenCoordinates.y(), lon, lat, GeoDataCoordinates::Degree );

        QVERIFY( retval ); // we want valid coordinates
        QFUZZYCOMPARE( lon, expected.longitude( GeoDataCoordinates::Degree ), 0.0001  );
        QFUZZYCOMPARE( lat, expected.latitude( GeoDataCoordinates::Degree ), 0.0001  );
    }
}
Esempio n. 3
0
void TestGudermannian::testGudermannian()
{
    QFETCH( qreal, angle );

    QFUZZYCOMPARE( atan( sinh ( angle * DEG2RAD ) ) * RAD2DEG, gd( angle * DEG2RAD ) * RAD2DEG, 0.1 );
}