| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 
 | 	//Question 1
	static boolean contientPoint(Rectangle R, int x1, int y1) {
		if ( x1>= R.x && x1<= R.x+R.longueur && y1>= R.y && y1<= R.y+R.hauteur ) {
			return true;
		}
		return false;
	}
 
	//Question 2
	static boolean intersecte(Rectangle R1, Rectangle R2) {
		boolean inter = false;
		if (R1.x == R2.x && R1.y == R2.y && R1.longueur == R2.longueur && R1.hauteur == R2.hauteur) {
			return inter;
		} else if (contientPoint(R1, R2.x, R2.y) || contientPoint(R1, R2.x+R2.longueur, R2.y) || contientPoint(R1, R2.x, R2.y+R2.hauteur) || contientPoint(R1, R2.x+R2.longueur, R2.y+R2.hauteur)) {
			inter = true;
		} 
		return inter;
	} | 
Partager