(rect: DOMRect)
| 107 | } |
| 108 | |
| 109 | function rectCorners(rect: DOMRect): Point[] { |
| 110 | let left = rect.left - PADDING; |
| 111 | let right = rect.right + PADDING; |
| 112 | let top = rect.top - PADDING; |
| 113 | let bottom = rect.bottom + PADDING; |
| 114 | return [ |
| 115 | {x: left, y: top}, |
| 116 | {x: right, y: top}, |
| 117 | {x: right, y: bottom}, |
| 118 | {x: left, y: bottom} |
| 119 | ]; |
| 120 | } |
| 121 | |
| 122 | // Computes the convex hull of a set of points using the monotone chain algorithm. |
| 123 | function convexHull(points: Point[]): Point[] { |