Commit 714a002b478e990a86ad8a29381f960b2dae86c5
Committed by
Jürgen Knödlseder
1 parent
b0021b1b
Changed algo of computing map extension: now computed from dist/PA relative to r…
…ect centre and their cartesian representation (previous implementation used difference in RA/DEC)
Showing
1 changed file
with
9 additions
and
4 deletions
src/sky/GSkyRegionMap.cpp
| @@ -657,14 +657,19 @@ void GSkyRegionMap::set_region_rect(const GSkyRegionRect* rect) | @@ -657,14 +657,19 @@ void GSkyRegionMap::set_region_rect(const GSkyRegionRect* rect) | ||
| 657 | // Get skydir of current corner | 657 | // Get skydir of current corner |
| 658 | GSkyDir corner = rect->get_corner(icorner); | 658 | GSkyDir corner = rect->get_corner(icorner); |
| 659 | 659 | ||
| 660 | - // Get extension along declination | ||
| 661 | - double dy = std::abs(corner.dec() - rect->centre().dec()); | 660 | + // Compute polar props in global coords relative to rectangle centre |
| 661 | + double dist = rect->centre().dist(corner); | ||
| 662 | + double pa = rect->centre().posang(corner); | ||
| 663 | + | ||
| 664 | + // Compute required map extension along RA/Dec for this corner | ||
| 665 | + double dx = dist * std::sin(pa); | ||
| 666 | + double dy = dist * std::cos(pa); | ||
| 667 | + | ||
| 668 | + // Select the largest extension | ||
| 662 | if (dy > dymax) { | 669 | if (dy > dymax) { |
| 663 | dymax = dy; | 670 | dymax = dy; |
| 664 | } | 671 | } |
| 665 | 672 | ||
| 666 | - // Get extension along right ascension, correct for spherical coordsys | ||
| 667 | - double dx = std::abs(corner.ra() - rect->centre().ra()) * std::cos(corner.dec()); | ||
| 668 | if (dx > dxmax) { | 673 | if (dx > dxmax) { |
| 669 | dxmax = dx; | 674 | dxmax = dx; |
| 670 | } | 675 | } |