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): point
(a, b)
| 92 | |
| 93 | |
| 94 | def _get_3rd_point(a, b): |
| 95 | """To calculate the affine matrix, three pairs of points are required. This |
| 96 | function is used to get the 3rd point, given 2D points a & b. |
| 97 | |
| 98 | The 3rd point is defined by rotating vector `a - b` by 90 degrees |
| 99 | anticlockwise, using b as the rotation center. |
| 100 | Args: |
| 101 | a (np.ndarray): point(x,y) |
| 102 | b (np.ndarray): point(x,y) |
| 103 | Returns: |
| 104 | np.ndarray: The 3rd point. |
| 105 | """ |
| 106 | assert len(a) == 2 |
| 107 | assert len(b) == 2 |
| 108 | direction = a - b |
| 109 | third_pt = b + np.array([-direction[1], direction[0]], dtype=np.float32) |
| 110 | |
| 111 | return third_pt |
| 112 | |
| 113 | |
| 114 | def rotate_point(pt, angle_rad): |
no outgoing calls
no test coverage detected