Box2f scale( const Box2f& b, float sx, float sy, float xcenter, float ycenter) { Box2f box = offsetBy( b, V2f( -xcenter, -ycenter)); box = scale( box, sx, sy); box = offsetBy( box, V2f( xcenter, ycenter)); return box; }
Box2i scale( const Box2i& b, float sx, float sy, int xcenter, int ycenter) { Box2i box = offsetBy( b, V2i( -xcenter, -ycenter)); box = scale( box, sx, sy); box = offsetBy( box, V2i( xcenter, ycenter)); return box; }
void scroll( const Imath::V2i& inc) { if( y_down_) world_ = offsetBy( world_, Imath::V2f( inc.x / zoom_x(), -inc.y / zoom_y())); else world_ = offsetBy( world_, Imath::V2f( inc.x / zoom_x(), inc.y / zoom_y())); }
void zoom( const Imath::V2f& center, float xfactor, float yfactor) { world_ = offsetBy( world_, Imath::V2f( -center.x, -center.y)); world_.min.x *= xfactor; world_.min.y *= yfactor; world_.max.x *= xfactor; world_.max.y *= yfactor; world_ = offsetBy( world_, Imath::V2f( center.x, center.y)); }
void scroll_to_center_point( const Imath::V2f& center) { world_ = offsetBy( world_, center - world_.center()); }