To calculate the affine matrix, three pairs of points are required. This function is used to get the 3rd point, given 2D points a & b. The 3rd point is defined by rotating vector `a - b` by 90 degrees anticlockwise, using b as the rotation center. Args: a (np.ndarray): poin
(a, b)
| 263 | |
| 264 | |
| 265 | def _get_3rd_point(a, b): |
| 266 | """To calculate the affine matrix, three pairs of points are required. This |
| 267 | function is used to get the 3rd point, given 2D points a & b. |
| 268 | |
| 269 | The 3rd point is defined by rotating vector `a - b` by 90 degrees |
| 270 | anticlockwise, using b as the rotation center. |
| 271 | |
| 272 | Args: |
| 273 | a (np.ndarray): point(x,y) |
| 274 | b (np.ndarray): point(x,y) |
| 275 | |
| 276 | Returns: |
| 277 | np.ndarray: The 3rd point. |
| 278 | """ |
| 279 | assert len(a) == 2 |
| 280 | assert len(b) == 2 |
| 281 | direction = a - b |
| 282 | third_pt = b + np.array([-direction[1], direction[0]], dtype=np.float32) |
| 283 | |
| 284 | return third_pt |
| 285 | |
| 286 | |
| 287 | def rotate_point(pt, angle_rad): |
no outgoing calls
no test coverage detected