(self, obj: Union[Line, HalfLine, Circle, HoleCircle])
| 325 | self.head = head |
| 326 | |
| 327 | def intersect(self, obj: Union[Line, HalfLine, Circle, HoleCircle]) -> Point: |
| 328 | if isinstance(obj, (HalfLine, Line)): |
| 329 | return line_line_intersection(self.line, obj) |
| 330 | |
| 331 | exclude = [self.tail] |
| 332 | if isinstance(obj, HoleCircle): |
| 333 | exclude += [obj.hole] |
| 334 | |
| 335 | a, b = line_circle_intersection(self.line, obj) |
| 336 | if any([a.close(x) for x in exclude]): |
| 337 | return b |
| 338 | if any([b.close(x) for x in exclude]): |
| 339 | return a |
| 340 | |
| 341 | v = self.head - self.tail |
| 342 | va = a - self.tail |
| 343 | vb = b - self.tail |
| 344 | if v.dot(va) > 0: |
| 345 | return a |
| 346 | if v.dot(vb) > 0: |
| 347 | return b |
| 348 | raise InvalidLineIntersectError() |
| 349 | |
| 350 | def sample_within(self, points: list[Point], n: int = 5) -> list[Point]: |
| 351 | center = sum(points, Point(0.0, 0.0)) * (1.0 / len(points)) |
nothing calls this directly
no test coverage detected