[Marble-commits] KDE/kdeedu/marble/src/lib/Projections
Bernhard Beschow
bbeschow at cs.tu-berlin.de
Wed Sep 1 13:34:34 CEST 2010
SVN commit 1170544 by beschow:
simplify SphericalProjection::geoCoordinates(), part 1
* multiply radius, centerX, and centerY by inverseRadius => radius becomes 1 and can be omitted
* multiply centerY by -1 => its square stays the same, qy == centerY
M +5 -6 SphericalProjection.cpp
--- trunk/KDE/kdeedu/marble/src/lib/Projections/SphericalProjection.cpp #1170543:1170544
@@ -197,13 +197,12 @@
const qreal inverseRadius = 1.0 / (qreal)(viewport->radius());
bool noerr = false;
- qreal radius = (qreal)( viewport->radius() );
- qreal centerX = (qreal)( x - viewport->width() / 2 );
- qreal centerY = (qreal)( y - viewport->height() / 2 );
+ qreal centerX = +(qreal)( x - viewport->width() / 2 ) * inverseRadius;
+ qreal centerY = -(qreal)( y - viewport->height() / 2 ) * inverseRadius;
- if ( radius * radius > centerX * centerX + centerY * centerY ) {
- qreal qx = inverseRadius * +centerX;
- qreal qy = inverseRadius * -centerY;
+ if ( 1 > centerX * centerX + centerY * centerY ) {
+ qreal qx = centerX;
+ qreal qy = centerY;
qreal qr = 1.0 - qy * qy;
qreal qr2z = qr - qx * qx;
More information about the Marble-commits
mailing list