boundingbox.cc
// Determines the bounding box of the given WCS and dimensions.
Determines the bounding box of the given WCS and dimensions.
Determines the bounding box of the given WCS and dimensions .
void BoundingBox::FindBoundingBox(const WcsProjection &wcs, int width,
                                  int height) {
  is_wrapped_ = false;
  crosses_north_pole_ = false;
  crosses_south_pole_ = false;
  FindBoundingBoxForKnownWrapped(wcs, width, height);
  if (WrapAround::ImageWrapsAround(ra_min_.ra, ra_max_.ra)) {
    is_wrapped_ = true;
    FindBoundingBoxForKnownWrapped(wcs, width, height);
  }
  double x;
  double y;
  double ra = 0.0;
  double dec = NORTH_POLE;
  crosses_north_pole_ = wcs.ToPixel(ra, dec, &x, &y);
  if (crosses_north_pole_) {
    dec_max_.SetValues(ra, dec, x, y);
  }
  ra = 0.0;
  dec = SOUTH_POLE;
  crosses_south_pole_ = wcs.ToPixel(ra, dec, &x, &y);
  if (crosses_south_pole_) {
    dec_min_.SetValues(ra, dec, x, y);
  }
}
void BoundingBox :: FindBoundingBox ( const WcsProjection & wcs , int width , int height ) { is_wrapped_ = false ; crosses_north_pole_ = false ; crosses_south_pole_ = false ; FindBoundingBoxForKnownWrapped ( wcs , width , height ) ; if ( WrapAround :: ImageWrapsAround ( ra_min_ . ra , ra_max_ . ra ) ) { is_wrapped_ = true ; FindBoundingBoxForKnownWrapped ( wcs , width , height ) ; } double x ; double y ; double ra = 0.0 ; double dec = NORTH_POLE ; crosses_north_pole_ = wcs . ToPixel ( ra , dec , & x , & y ) ; if ( crosses_north_pole_ ) { dec_max_ . SetValues ( ra , dec , x , y ) ; } ra = 0.0 ; dec = SOUTH_POLE ; crosses_south_pole_ = wcs . ToPixel ( ra , dec , & x , & y ) ; if ( crosses_south_pole_ ) { dec_min_ . SetValues ( ra , dec , x , y ) ; } }
Determines the bounding box of the given WCS and dimensions.
Determines the bounding box of the given WCS and dimensions .
// If the image wraps around the 0-360 discontinuity, the max and min values // will be incorrect because ra is not monotonic across the image.  To fix // this we flag the image as wrapped and re-compute the max and min values. // FindBoundingBox() adjusts ra to be monotonic across the image if the // is_wrapped_ flag is true. // If the image crosses either pole, then the max or min dec will be interior // to the image, so the bounding box is wrong.  We check for this and // adjust the limits accordingly.