boundingbox.cc
// Determines the bounding box for wrapped and non-wrapped images.
Determines the bounding box for wrapped and non-wrapped images.
Determines the bounding box for wrapped and non - wrapped images .
void BoundingBox::FindBoundingBoxForKnownWrapped(const WcsProjection &wcs,
                                                 int width, int height) {
  double x;
  double y;
  ra_min_.SetValues(LARGE_BAD_VALUE, LARGE_BAD_VALUE, 0.0, 0.0);
  ra_max_.SetValues(SMALL_BAD_VALUE, SMALL_BAD_VALUE, 0.0, 0.0);
  dec_min_.SetValues(LARGE_BAD_VALUE, LARGE_BAD_VALUE, 0.0, 0.0);
  dec_max_.SetValues(SMALL_BAD_VALUE, SMALL_BAD_VALUE, 0.0, 0.0);
  y = 1.0;
  for (int i = 1; i <= width; ++i) {
    x = static_cast<double>(i);
    UpdateExtrema(wcs, x, y);
  }
  y = static_cast<double>(height);
  for (int i = 1; i <= width; ++i) {
    x = static_cast<double>(i);
    UpdateExtrema(wcs, x, y);
  }
  x = 1.0;
  for (int i = 1; i <= height; ++i) {
    y = static_cast<double>(i);
    UpdateExtrema(wcs, x, y);
  }
  x = static_cast<double>(width);
  for (int i = 1; i <= height; ++i) {
    y = static_cast<double>(i);
    UpdateExtrema(wcs, x, y);
  }
  CHECK_LT(ra_min_.ra, LARGE_BAD_VALUE);
  CHECK_LT(ra_min_.dec, LARGE_BAD_VALUE);
  CHECK_GT(ra_max_.ra, SMALL_BAD_VALUE);
  CHECK_GT(ra_max_.dec, SMALL_BAD_VALUE);
  CHECK_LT(dec_min_.ra, LARGE_BAD_VALUE);
  CHECK_LT(dec_min_.dec, LARGE_BAD_VALUE);
  CHECK_GT(dec_max_.ra, SMALL_BAD_VALUE);
  CHECK_GT(dec_max_.dec, SMALL_BAD_VALUE);
}
void BoundingBox :: FindBoundingBoxForKnownWrapped ( const WcsProjection & wcs , int width , int height ) { double x ; double y ; ra_min_ . SetValues ( LARGE_BAD_VALUE , LARGE_BAD_VALUE , 0.0 , 0.0 ) ; ra_max_ . SetValues ( SMALL_BAD_VALUE , SMALL_BAD_VALUE , 0.0 , 0.0 ) ; dec_min_ . SetValues ( LARGE_BAD_VALUE , LARGE_BAD_VALUE , 0.0 , 0.0 ) ; dec_max_ . SetValues ( SMALL_BAD_VALUE , SMALL_BAD_VALUE , 0.0 , 0.0 ) ; y = 1.0 ; for ( int i = 1 ; i <= width ; ++ i ) { x = static_cast < double > ( i ) ; UpdateExtrema ( wcs , x , y ) ; } y = static_cast < double > ( height ) ; for ( int i = 1 ; i <= width ; ++ i ) { x = static_cast < double > ( i ) ; UpdateExtrema ( wcs , x , y ) ; } x = 1.0 ; for ( int i = 1 ; i <= height ; ++ i ) { y = static_cast < double > ( i ) ; UpdateExtrema ( wcs , x , y ) ; } x = static_cast < double > ( width ) ; for ( int i = 1 ; i <= height ; ++ i ) { y = static_cast < double > ( i ) ; UpdateExtrema ( wcs , x , y ) ; } CHECK_LT ( ra_min_ . ra , LARGE_BAD_VALUE ) ; CHECK_LT ( ra_min_ . dec , LARGE_BAD_VALUE ) ; CHECK_GT ( ra_max_ . ra , SMALL_BAD_VALUE ) ; CHECK_GT ( ra_max_ . dec , SMALL_BAD_VALUE ) ; CHECK_LT ( dec_min_ . ra , LARGE_BAD_VALUE ) ; CHECK_LT ( dec_min_ . dec , LARGE_BAD_VALUE ) ; CHECK_GT ( dec_max_ . ra , SMALL_BAD_VALUE ) ; CHECK_GT ( dec_max_ . dec , SMALL_BAD_VALUE ) ; }
Determines the bounding box for wrapped and non-wrapped images.
Determines the bounding box for wrapped and non - wrapped images .
// Intentionally bad values. // The loops here sum integers instead of doubles for increased numerical // accuracy.  The added accuracy shouldn't be needed, but these loops aren't // performance critical, so we just keep the extra precision just in case. // NB: There are 2 duplicate corner calculations, wasting 4 calculations. // 1st edge // 2nd edge // 3rd edge // 4th edge // Sanity checks.