If I have point A, point B and point C. In Java, how would I check if any of the rectangle is in-between the two points?
Try the intersectsLine(Line2D l) method of java.awt.geom.Rectangle2D:
intersectsLine(Line2D l)
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.
Try the
intersectsLine(Line2D l)
method ofjava.awt.geom.Rectangle2D
: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.