(other: IRectangle, out?: Rectangle)
| 137 | } |
| 138 | |
| 139 | public union(other: IRectangle, out?: Rectangle): Rectangle { |
| 140 | const x = Math.min(this.x, other.x); |
| 141 | const y = Math.min(this.y, other.y); |
| 142 | const right = Math.max(this.right, other.x + other.width); |
| 143 | const bottom = Math.max(this.bottom, other.y + other.height); |
| 144 | |
| 145 | out = out || new Rectangle(); |
| 146 | return out.set(x, y, right - x, bottom - y); |
| 147 | } |
| 148 | |
| 149 | public isEmpty(): boolean { |
| 150 | return this.width <= 0 || this.height <= 0; |