Java Rectangle Fit fits(Rectangle2D o1, Rectangle2D o2)

Here you can find the source of fits(Rectangle2D o1, Rectangle2D o2)

Description

Takes two rectangles and check if the first fits into the second

License

Creative Commons License

Parameter

Parameter Description
o1 rectangle to be contained
o2 rectangle to be the container

Return

true if o1 fits into o2, false otherwise

Declaration

public static boolean fits(Rectangle2D o1, Rectangle2D o2) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

import java.awt.geom.Rectangle2D;

public class Main {
    /**/*from w w w  .j  a  v a 2 s .  c  o m*/
     * Takes two rectangles and check if the first fits into the second
     *
     * @param o1 rectangle to be contained
     * @param o2 rectangle to be the container
     * @return true if o1 fits into o2, false otherwise
     * @see Rectangle2D
     */
    public static boolean fits(Rectangle2D o1, Rectangle2D o2) {
        return (o1.getHeight() <= o2.getHeight() && o1.getWidth() <= o2.getWidth());
    }
}

Related

  1. fitRectangle(Rectangle rect, Dimension d)
  2. fitRectangle(Rectangle rect, Rectangle target)
  3. fitRectangles(Dimension imageSize, Dimension size)
  4. fitRectInRect(Rectangle rect, Rectangle bounds)
  5. fits(Rectangle r)
  6. fitsInside(Dimension2D dim, Rectangle2D rect)
  7. fitsRotated(Rectangle2D o1, Rectangle2D o2)
  8. reScale(Rectangle rect, int oldScale, int newScale)
  9. shrinkToFit(Rectangle container, Rectangle item)