Calculate the cross product of vectors OA and OB. Returns: > 0: Counter-clockwise turn (left turn) = 0: Collinear < 0: Clockwise turn (right turn)
(origin: Point, point_a: Point, point_b: Point)
| 42 | |
| 43 | |
| 44 | def _cross_product(origin: Point, point_a: Point, point_b: Point) -> float: |
| 45 | """ |
| 46 | Calculate the cross product of vectors OA and OB. |
| 47 | |
| 48 | Returns: |
| 49 | > 0: Counter-clockwise turn (left turn) |
| 50 | = 0: Collinear |
| 51 | < 0: Clockwise turn (right turn) |
| 52 | """ |
| 53 | return (point_a.x - origin.x) * (point_b.y - origin.y) - (point_a.y - origin.y) * ( |
| 54 | point_b.x - origin.x |
| 55 | ) |
| 56 | |
| 57 | |
| 58 | def _is_point_on_segment(p1: Point, p2: Point, point: Point) -> bool: |
no outgoing calls
no test coverage detected