Note, this actually changes this Rect (if that wasn't obvious)
760084
public final void moveInside(Rect bounds) {
	// check the right edge
	int distanceOffRightSide = (x + w) - (bounds.x + bounds.w);
	if (distanceOffRightSide > 0) {
	    x -= distanceOffRightSide;
	}
	// check the left edge (we prefer this to fit)
	int distanceOffLeftSide = bounds.x - x;
	if (distanceOffLeftSide > 0) {
	    x += distanceOffLeftSide;
	}

	// check the bottom edge
	int distanceOffBottom = (y + h) - (bounds.y + bounds.h);
	if (distanceOffBottom > 0) {
	    y -= distanceOffBottom;
	}
	// check the top edge (we prefer this to fit)
	int distanceOffTop = bounds.y - y;
	if (distanceOffTop > 0) {
	    y += distanceOffTop;
	}	
    }
17442
def console_rect(
    con: tcod.console.Console,
    x: int,
    y: int,
    w: int,
    h: int,
    clr: bool,
    flag: int = BKGND_DEFAULT,
) -> None:
    
    lib.TCOD_console_rect(_console(con), x, y, w, h, clr, flag)
669084
def update_anchor(self):
        
        t = self.transform
        self.update_collision_rect()
        if t.anchor_x_r and t.anchor_y_r:
            t.anchor_x = self.min_x + (self.max_x - self.min_x) * t.anchor_x_r
            t.anchor_y = self.min_y + (self.max_y - self.min_y) * t.anchor_y_r
1097836
function doesIntersect (rect1, rect2) {
  let intersectLeftRight;
  let intersectTopBottom;

  const rect1Points = rectToPoints(rect1);
  const rect2Points = rectToPoints(rect2);

  if (rect1.width >= 0) {
    if (rect2.width >= 0) {
      intersectLeftRight = !((rect1Points.bottomRight.x <= rect2Points.topLeft.x) || (rect2Points.bottomRight.x <= rect1Points.topLeft.x));
    } else {
      intersectLeftRight = !((rect1Points.bottomRight.x <= rect2Points.bottomRight.x) || (rect2Points.topLeft.x <= rect1Points.topLeft.x));
    }
  } else if (rect2.width >= 0) {
    intersectLeftRight = !((rect1Points.topLeft.x <= rect2Points.topLeft.x) || (rect2Points.bottomRight.x <= rect1Points.bottomRight.x));
  } else {
    intersectLeftRight = !((rect1Points.topLeft.x <= rect2Points.bottomRight.x) || (rect2Points.topLeft.x <= rect1Points.bottomRight.x));
  }

  if (rect1.height >= 0) {
    if (rect2.height >= 0) {
      intersectTopBottom = !((rect1Points.bottomRight.y <= rect2Points.topLeft.y) || (rect2Points.bottomRight.y <= rect1Points.topLeft.y));
    } else {
      intersectTopBottom = !((rect1Points.bottomRight.y <= rect2Points.bottomRight.y) || (rect2Points.topLeft.y <= rect1Points.topLeft.y));
    }
  } else if (rect2.height >= 0) {
    intersectTopBottom = !((rect1Points.topLeft.y <= rect2Points.topLeft.y) || (rect2Points.bottomRight.y <= rect1Points.bottomRight.y));
  } else {
    intersectTopBottom = !((rect1Points.topLeft.y <= rect2Points.bottomRight.y) || (rect2Points.top <= rect1Points.bottomRight.y));
  }

  return intersectLeftRight && intersectTopBottom;
}
751204
function(x, y, evt) {

    // center is at half size
    center.set(x/2, y/2);

    var shift = x/10;
    line1.set(x/2 + shift, 0);
    line1.p1.set(x/2 - shift, y);

    line2.set(0, y/2 - shift);
    line2.p1.set(x, y/2 + shift);

    rect.size( x/2, y/2 );
    rect.setCenter( x/2, y/2 );
  }
1237311
function updateBounds() {
         if (this.shapes.length > 0) {
           // reset the rect with default values
           var _bounds = this.shapes[0].getBounds();

           this.pos.setV(_bounds.pos);
           this.resize(_bounds.width, _bounds.height);

           for (var i = 1; i < this.shapes.length; i++) {
             this.union(this.shapes[i].getBounds());
           }
         } // trigger the onBodyChange


         if (typeof this.onBodyUpdate === "function") {
           this.onBodyUpdate(this);
         }

         return this;
       }
298127
private void changeCurrToReference() {
		Se2_F64 keyToCurr = currToKey.invert(null);

		List<PointTrack> all = tracker.getAllTracks(null);

		for (PointTrack t : all) {
			VoTrack p = t.getCookie();

			if (p.onPlane) {
				SePointOps_F64.transform(keyToCurr, p.ground, p.ground);
			} else {
				GeometryMath_F64.rotate(keyToCurr.c, keyToCurr.s, p.ground, p.ground);
			}
		}

		concatMotion();
	}
139496
public static void shiftToContain (Rectangle tainer, Rectangle tained)
    {
        if (tained.x < tainer.x) {
            tainer.x = tained.x;
        }
        if (tained.y < tainer.y) {
            tainer.y = tained.y;
        }
        if (tained.x + tained.width > tainer.x + tainer.width) {
            tainer.x = tained.x - (tainer.width - tained.width);
        }
        if (tained.y + tained.height > tainer.y + tainer.height) {
            tainer.y = tained.y - (tainer.height - tained.height);
        }
    }
785238
def width_radius_changed_cb(self, widget, val):
        """"""
        self.width_radius = val
        self.redraw_cuts()
        self.replot_all()
        return True
1164359
function copy(rect) {
         return this.setShape(rect.pos.x, rect.pos.y, rect._width, rect._height);
       }
828240
def flipVertical(self):
        
        
        self.flipV = not self.flipV
        self._transmogrophy(self.angle, self.percent, self.scaleFromCenter, self.flipH, self.flipV)
619690
public void set(Rect src) {
        this.left = src.left;
        this.top = src.top;
        this.right = src.right;
        this.bottom = src.bottom;
    }
1358619
function changeLayout(cls) {
        $('body').toggleClass(cls)
        $layout.fixSidebar()
        if ($('body').hasClass('fixed') && cls == 'fixed') {
            $pushMenu.expandOnHover()
            $layout.activate()
        }
        $controlSidebar.fix()
    }
154220
function(rectangle) {
        var topLeft = this.viewport.pixelFromPointNoRotate(rectangle.getTopLeft(), true);
        var size = this.viewport.deltaPixelsFromPointsNoRotate(rectangle.getSize(), true);

        return new $.Rect(
            topLeft.x * $.pixelDensityRatio,
            topLeft.y * $.pixelDensityRatio,
            size.x * $.pixelDensityRatio,
            size.y * $.pixelDensityRatio
        );
    }
245052
function() {
        var rectSize = 150;

        // clear the background
        me.game.world.addChild(new me.ColorLayer("background", "black"), 0);

        // add a few shapes
        me.game.world.addChild(new game.Square(50, 50, {width: rectSize, height: rectSize}), 1);
        me.game.world.addChild(new game.Square(50, 400, {width: rectSize, height: rectSize}), 1);
        me.game.world.addChild(new game.Square(300, 125, {width: rectSize, height: rectSize}), 1);
        me.game.world.addChild(new game.Square(300, 350, {width: rectSize, height: rectSize}), 1);
        me.game.world.addChild(new game.Square(600, 200, {width: rectSize, height: rectSize}), 1);
        me.game.world.addChild(new game.Square(600, 400, {width: rectSize, height: rectSize}), 1);

        me.game.repaint();

        // display the current pointer coordinates on top of the pointer arrow
        // and some helper text at the bottom of the viewport
        me.game.world.addChild(new (me.Renderable.extend({
            init: function() {
                this._super(me.Renderable, 'init', [0, 0, 10, 10]);
                this.font = new me.Font("Arial", 10, "#FFFFFF");
                this.font.textAlign = "center";
                this.fontHeight = this.font.measureText(me.video.renderer, "DUMMY").height;
            },
            update : function (dt) {
                return true;
            },
            draw: function(renderer) {
                var x = Math.round(me.input.pointer.gameWorldX);
                var y = Math.round(me.input.pointer.gameWorldY);

                this.font.draw (
                    renderer,
                    "( " + x + "," + y + " )",
                    x,
                    y - this.fontHeight);

                this.font.draw (
                    renderer,
                    "drag the square to check for intersection witht the line",
                    150,
                    me.game.viewport.height - this.fontHeight
                );
            }
        })), 10);

        // basic renderable that cast a ray across the world
        me.game.world.addChild(new (me.Renderable.extend({
            init: function() {
                this._super(me.Renderable, 'init', [0, 0, 10, 10]);
                this.line = new me.Line(me.game.viewport.width / 2, me.game.viewport.height / 2, [
                    new me.Vector2d(0, 0),
                    new me.Vector2d(me.game.viewport.width / 2, me.game.viewport.height / 2)
                ]);

            },
            update : function (dt) {
                this.line.rotate(0.0125);
                var result = me.collision.rayCast(this.line);

                if (result.length > 0) {
                    for (var i = 0; i < result.length; i++) {
                        // update the object isColliding flag
                        result[i].isColliding = true;
                    }
                }
                return true;
            },
            draw: function(renderer) {
                renderer.setColor("red");
                renderer.stroke(this.line);
            }
        })), 10);
    }
184616
function (dx, dy) {
        var self = this, rect = self.layoutRect();

        self.moveTo(rect.x + dx, rect.y + dy);

        return self;
      }
910487
function(angle) {

            if (!angle) return this.clone();

            var theta = toRad(angle);
            var st = abs(sin(theta));
            var ct = abs(cos(theta));
            var w = this.width * ct + this.height * st;
            var h = this.width * st + this.height * ct;
            return new Rect(this.x + (this.width - w) / 2, this.y + (this.height - h) / 2, w, h);
        }