Update Rect_Geo.mdx

This commit is contained in:
Darren Yao 2020-07-20 14:07:42 -07:00 committed by GitHub
parent df576bae02
commit fce814c8f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,13 +89,13 @@ To create a new rectangle, use the following constructor:
Rectangle newRect = new Rectangle(x, y, width, height);
```
The `Rectangle` class supports numerous useful methods.
The `Rectangle` class supports numerous useful methods, including the following:
- `firstRect.intersects(secondRect)` checks if two rectangles intersect.
- `firstRect.union(secondRect)` returns a rectangle representing the union of two rectangles.
- `firstRect.contains(x, y)` checks whether the integer point $(x,y)$ exists in firstRect.
- `firstRect.intersection(secondRect)` returns a rectangle representing the intersection of two rectangles.
- what happens when intersection is empty?
- `firstRect.intersects(secondRect)` checks if two rectangles intersect.
- `firstRect.union(secondRect)` returns a rectangle representing the union of two rectangles.
- `firstRect.contains(x, y)` checks whether the integer point $(x,y)$ exists in firstRect.
- `firstRect.intersection(secondRect)` returns a rectangle representing the intersection of two rectangles.
- what happens when intersection is empty?
This class can often lessen the implementation needed in a lot of bronze problems and CodeForces problems.