regionator.cc
// Sets the max tile side length so that the aspect ratio of the image is
// preserved in the tiles.
Sets the max tile side length so that the aspect ratio of the image is
preserved in the tiles.
Sets the max tile side length so that the aspect ratio of the image is preserved in the tiles .
void Regionator::SetMaxTileSideLength(int side_length) {
  assert(side_length > 0);
  double aspect_ratio = static_cast<double>(image_->width()) /
                        static_cast<double>(image_->height());
  if (image_->width() > image_->height()) {
    x_tile_size_ = side_length;
    y_tile_size_ = static_cast<int>(side_length / aspect_ratio + 0.5);
  } else {
    x_tile_size_ = static_cast<int>(side_length * aspect_ratio + 0.5);
    y_tile_size_ = side_length;
  }
  assert(x_tile_size_ > 0);
  assert(y_tile_size_ > 0);
}
void Regionator :: SetMaxTileSideLength ( int side_length ) { assert ( side_length > 0 ) ; double aspect_ratio = static_cast < double > ( image_ -> width ( ) ) / static_cast < double > ( image_ -> height ( ) ) ; if ( image_ -> width ( ) > image_ -> height ( ) ) { x_tile_size_ = side_length ; y_tile_size_ = static_cast < int > ( side_length / aspect_ratio + 0.5 ) ; } else { x_tile_size_ = static_cast < int > ( side_length * aspect_ratio + 0.5 ) ; y_tile_size_ = side_length ; } assert ( x_tile_size_ > 0 ) ; assert ( y_tile_size_ > 0 ) ; }
Sets the max tile side length so that the aspect ratio of the image is
preserved in the tiles.
Sets the max tile side length so that the aspect ratio of the image is preserved in the tiles .
// Keep the aspect ratio of the image with a maximum tile size of // side_length.