Java Utililty Methods Rectangle Contain

List of utility methods to do Rectangle Contain

  1. HOME
  2. Java
  3. R
  4. Rectangle Contain

Description

The list of methods to do Rectangle Contain are organized into topic(s).

Method

boolean contains(Rectangle c, Rectangle a)
contains
return c.x <= a.x + a.width && c.x + c.width > a.x && c.y <= a.y + a.height && c.y + c.height > a.y;
boolean contains(Rectangle rect1, Rectangle rect2)
Returns true if the first rectangle completely contains the second one.
return (rect2.x >= rect1.x) && (rect2.y >= rect1.y) && (rect2.x + rect2.width <= rect1.x + rect1.width)
 && (rect2.y + rect2.height <= rect1.y + rect1.height);
Rectangle stretchToFit(Rectangle container, Rectangle item)
stretch To Fit
double scale = scaleProportional(container, item);
if (scale < 1) {
 return item;
} else {
 return new Rectangle((int) (item.width * scale), (int) (item.height * scale));

AltStyle によって変換されたページ (->オリジナル) /