bezier.pyi 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. from collections.abc import Callable
  2. from typing import Literal
  3. import numpy as np
  4. from numpy.typing import ArrayLike
  5. from .path import Path
  6. class NonIntersectingPathException(ValueError): ...
  7. def get_intersection(
  8. cx1: float,
  9. cy1: float,
  10. cos_t1: float,
  11. sin_t1: float,
  12. cx2: float,
  13. cy2: float,
  14. cos_t2: float,
  15. sin_t2: float,
  16. ) -> tuple[float, float]: ...
  17. def get_normal_points(
  18. cx: float, cy: float, cos_t: float, sin_t: float, length: float
  19. ) -> tuple[float, float, float, float]: ...
  20. def split_de_casteljau(beta: ArrayLike, t: float) -> tuple[np.ndarray, np.ndarray]: ...
  21. def find_bezier_t_intersecting_with_closedpath(
  22. bezier_point_at_t: Callable[[float], tuple[float, float]],
  23. inside_closedpath: Callable[[tuple[float, float]], bool],
  24. t0: float = ...,
  25. t1: float = ...,
  26. tolerance: float = ...,
  27. ) -> tuple[float, float]: ...
  28. # TODO make generic over d, the dimension? ndarraydim
  29. class BezierSegment:
  30. def __init__(self, control_points: ArrayLike) -> None: ...
  31. def __call__(self, t: ArrayLike) -> np.ndarray: ...
  32. def point_at_t(self, t: float) -> tuple[float, ...]: ...
  33. @property
  34. def control_points(self) -> np.ndarray: ...
  35. @property
  36. def dimension(self) -> int: ...
  37. @property
  38. def degree(self) -> int: ...
  39. @property
  40. def polynomial_coefficients(self) -> np.ndarray: ...
  41. def axis_aligned_extrema(self) -> tuple[np.ndarray, np.ndarray]: ...
  42. def split_bezier_intersecting_with_closedpath(
  43. bezier: ArrayLike,
  44. inside_closedpath: Callable[[tuple[float, float]], bool],
  45. tolerance: float = ...,
  46. ) -> tuple[np.ndarray, np.ndarray]: ...
  47. def split_path_inout(
  48. path: Path,
  49. inside: Callable[[tuple[float, float]], bool],
  50. tolerance: float = ...,
  51. reorder_inout: bool = ...,
  52. ) -> tuple[Path, Path]: ...
  53. def inside_circle(
  54. cx: float, cy: float, r: float
  55. ) -> Callable[[tuple[float, float]], bool]: ...
  56. def get_cos_sin(x0: float, y0: float, x1: float, y1: float) -> tuple[float, float]: ...
  57. def check_if_parallel(
  58. dx1: float, dy1: float, dx2: float, dy2: float, tolerance: float = ...
  59. ) -> Literal[-1, False, 1]: ...
  60. def get_parallels(
  61. bezier2: ArrayLike, width: float
  62. ) -> tuple[list[tuple[float, float]], list[tuple[float, float]]]: ...
  63. def find_control_points(
  64. c1x: float, c1y: float, mmx: float, mmy: float, c2x: float, c2y: float
  65. ) -> list[tuple[float, float]]: ...
  66. def make_wedged_bezier2(
  67. bezier2: ArrayLike, width: float, w1: float = ..., wm: float = ..., w2: float = ...
  68. ) -> tuple[list[tuple[float, float]], list[tuple[float, float]]]: ...