[Solved] Check if Rectangle is between two points [closed]


Try the intersectsLine(Line2D l) method of java.awt.geom.Rectangle2D:

Rectangle2D.Double rect = new Rectangle2D.Double(double x, double y, double w, double h);
System.out.println(rect.intersectsLine(new Line2D.Double(double xA, double yA, double xB, double yB)));

where xA,yA, xB,yB are the x and y coordinates, respectively, of points A and B which you wish to check if the rectangle is between.

solved Check if Rectangle is between two points [closed]