[Kstars-devel] KDE/kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Sat Dec 15 18:37:01 CET 2007
SVN commit 748836 by harris:
Two more fixes for the Equirectangular projection:
(1) make coordinates wrap properly around the RA=0 or Az=0 lines
(2) Fix bug in SkyMap::toScreen() that caused bizarre
mouse+keyboard navigation in AltAz mode (I had been interpreting
the Y-axis as Declination, even in AltAz mode!)
CCMAIL: kstars-devel at kde.org
M +13 -5 skymap.cpp
--- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #748835:748836
@@ -884,18 +884,22 @@
else Y = o->alt()->radians();
if ( focus()->az()->Degrees() > 270.0 && o->az()->Degrees() < 90.0 ) {
- dX = 2*dms::PI + focus()->az()->radians() - o->az()->radians();
+ dX = -2.0*dms::PI + focus()->az()->reduce().radians() - o->az()->reduce().radians();
+ } else if ( focus()->az()->Degrees() < 90.0 && o->az()->Degrees() > 270.0 ) {
+ dX = 2.0*dms::PI + focus()->az()->reduce().radians() - o->az()->reduce().radians();
} else {
- dX = focus()->az()->radians() - o->az()->radians();
+ dX = focus()->az()->reduce().radians() - o->az()->reduce().radians();
}
focus()->alt()->SinCos( sinY0, cosY0 );
} else {
if (focus()->ra()->Hours() > 18.0 && o->ra()->Hours() < 6.0) {
- dX = 2*dms::PI + o->ra()->radians() - focus()->ra()->radians();
+ dX = 2.0*dms::PI + o->ra()->reduce().radians() - focus()->ra()->reduce().radians();
+ } else if (focus()->ra()->Hours() < 6.0 && o->ra()->Hours() > 18.0) {
+ dX = o->ra()->reduce().radians() - focus()->ra()->reduce().radians() - 2.0*dms::PI;
} else {
- dX = o->ra()->radians() - focus()->ra()->radians();
+ dX = o->ra()->reduce().radians() - focus()->ra()->reduce().radians();
}
Y = o->dec()->radians();
focus()->dec()->SinCos( sinY0, cosY0 );
@@ -903,8 +907,12 @@
//Special case: Equirectangular projection is very simple
if ( Options::projection() == Equirectangular ) {
+
p.setX( 0.5*Width - zoomscale*dX );
- p.setY( 0.5*Height - zoomscale*(Y - focus()->dec()->radians()) );
+ if ( Options::useAltAz() )
+ p.setY( 0.5*Height - zoomscale*(Y - focus()->alt()->radians()) );
+ else
+ p.setY( 0.5*Height - zoomscale*(Y - focus()->dec()->radians()) );
if ( onVisibleHemisphere != NULL ) {
if ( scaledRect().contains( p.toPoint() ) ) //FIXME -jbb
More information about the Kstars-devel
mailing list