This repository has been archived by the owner on Dec 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reclange_responce.php
94 lines (83 loc) · 3.54 KB
/
reclange_responce.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
include 'classes.php';
if (isset($_POST)) {
if (isset($_POST['surface']) && isset($_POST['rec-p-xy']) && isset($_POST["rec-h"]) && isset($_POST["rec-w"])) {
$xy = $_POST['rec-p-xy'];
$x = $xy[0];
$y = $xy[3];
$h = $_POST["rec-h"];
$w = $_POST["rec-w"];
$rec = new Rectangle($h, $w, new Point($x, $y));
if (empty($xy) || empty($h) || empty($w))
echo "remplir les champs";
else
echo "surface du rectangle est :" . $rec->surface();
}
if (isset($_POST['inter1']) && isset($_POST['rec-p-xy']) && isset($_POST["rec-h"]) && isset($_POST["rec-w"]) && isset($_POST["p-xy"])) {
$xy = $_POST['rec-p-xy'];
$x = $xy[0];
$y = $xy[3];
$h = $_POST['rec-h'];
$w = $_POST['rec-w'];
$p_xy = $_POST['p-xy'];
$p_x = $p_xy[0];
$p_y = $p_xy[3];
$rec = new Rectangle($h, $w, new Point($x, $y));
if (empty($xy) || empty($h) || empty($w) || empty($xy))
echo "remplir les champs";
else
echo $rec->interieur1(new Point($p_x, $p_y)) ? "le point est interieur de la rectangle" : "le point n'est pas interieur de la rectangle";
}
if (isset($_POST['inter2']) && isset($_POST['rec-p-xy']) && isset($_POST["rec-h"]) && isset($_POST["rec-w"]) && isset($_POST['inter2']) && isset($_POST['rec2-p-xy']) && isset($_POST["rec2-h"]) && isset($_POST["rec2-w"])) {
// ---------------------------- //
$xy = $_POST['rec-p-xy'];
$x = $xy[0];
$y = $xy[3];
$h = $_POST['rec-h'];
$w = $_POST['rec-w'];
// rectangle 1
$rec1 = new Rectangle($h, $w, new Point($x, $y));
if (empty($xy) || empty($h) || empty($w))
echo "remplir les champs des rectangle 1" . "<br/>";
// ---------------------------- //
$xy = $_POST['rec2-p-xy'];
$x = $xy[0];
$y = $xy[3];
$h = $_POST['rec2-h'];
$w = $_POST['rec2-w'];
// rectangle 2
$rec2 = new Rectangle($h, $w, new Point($x, $y));
// ---------------------------- //
if (empty($xy) || empty($h) || empty($w))
echo "remplir les champs des rectangle 2" . "<br/>";
else
echo $rec1->interieur2($rec2) ?
"le rectangle 2 est interieur de la rectangle 1" : "le rectangle 2 n'est pas interieur du rectangle 1";
}
if (isset($_POST['egalite']) && isset($_POST['rec-p-xy']) && isset($_POST["rec-h"]) && isset($_POST["rec-w"]) && isset($_POST['rec2-p-xy']) && isset($_POST["rec2-h"]) && isset($_POST["rec2-w"])) {
// ---------------------------- //
$xy = $_POST['rec-p-xy'];
$x = $xy[0];
$y = $xy[3];
$h = $_POST['rec-h'];
$w = $_POST['rec-w'];
if (empty($xy) || empty($h) || empty($w))
echo "remplir les champs des rectangle 1" . "<br/>";
// rectangle 1
$rec1 = new Rectangle($h, $w, new Point($x, $y));
// ---------------------------- //
$xy = $_POST['rec2-p-xy'];
$x = $xy[0];
$y = $xy[3];
$h = $_POST['rec2-h'];
$w = $_POST['rec2-w'];
// rectangle 2
$rec2 = new Rectangle($h, $w, new Point($x, $y));
// ---------------------------- //
if (empty($xy) || empty($h) || empty($w))
echo "remplir les champs des rectangle 2" . "<br/>";
else
echo $rec1->egalite($rec2) ?
"le rectangle 1 et le rectangle 2 sont egaux" : "le rectangle 1 et le rectangle 2 sont diferent";
}
}