Brian Silverman | 4e662aa | 2022-05-11 23:10:19 -0700 | [diff] [blame] | 1 | // Copyright 2021 Google LLC |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 4 | // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 5 | // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your |
| 6 | // option. This file may not be copied, modified, or distributed |
| 7 | // except according to those terms. |
| 8 | |
| 9 | #pragma once |
| 10 | #include <iostream> |
| 11 | |
| 12 | struct Point { |
| 13 | int x; |
| 14 | int y; |
| 15 | }; |
| 16 | |
| 17 | class Rect { |
| 18 | public: |
| 19 | Point top_left; |
| 20 | Point bottom_right; |
| 21 | int width() const { return bottom_right.x - top_left.x; } |
| 22 | int height() const { return bottom_right.y - top_left.y; } |
| 23 | }; |
| 24 | |
| 25 | inline void print_point(Point p) { |
| 26 | std::cout << "(" << p.x << ", " << p.y << ")\n"; |
| 27 | } |