| 113 | */ |
| 114 | |
| 115 | staticfn boolean |
| 116 | intersect(NhRect *r1, NhRect *r2, NhRect *r3) |
| 117 | { |
| 118 | if (r2->lx > r1->hx || r2->ly > r1->hy || r2->hx < r1->lx |
| 119 | || r2->hy < r1->ly) |
| 120 | return FALSE; |
| 121 | |
| 122 | r3->lx = (r2->lx > r1->lx ? r2->lx : r1->lx); |
| 123 | r3->ly = (r2->ly > r1->ly ? r2->ly : r1->ly); |
| 124 | r3->hx = (r2->hx > r1->hx ? r1->hx : r2->hx); |
| 125 | r3->hy = (r2->hy > r1->hy ? r1->hy : r2->hy); |
| 126 | |
| 127 | if (r3->lx > r3->hx || r3->ly > r3->hy) |
| 128 | return FALSE; |
| 129 | return TRUE; |
| 130 | } |
| 131 | |
| 132 | /* Put the rectangle containing both r1 and r2 into r3 */ |
| 133 | void |