linalg.pyi 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. from typing import overload
  2. class vec2:
  3. x: float
  4. y: float
  5. def __init__(self, x: float, y: float) -> None: ...
  6. def copy(self) -> vec2: ...
  7. def __add__(self, other: vec2) -> vec2: ...
  8. def __sub__(self, other: vec2) -> vec2: ...
  9. def __mul__(self, other: float) -> vec2: ...
  10. def __truediv__(self, other: float) -> vec2: ...
  11. def dot(self, other: vec2) -> float: ...
  12. def cross(self, other: vec2) -> float: ...
  13. def length(self) -> float: ...
  14. def length_squared(self) -> float: ...
  15. def normalize(self) -> None: ...
  16. def normalized(self) -> vec2: ...
  17. class mat3x3:
  18. _11: float
  19. _12: float
  20. _13: float
  21. _21: float
  22. _22: float
  23. _23: float
  24. _31: float
  25. _32: float
  26. _33: float
  27. @overload
  28. def __init__(self) -> None: ...
  29. @overload
  30. def __init__(self, _11, _12, _13, _21, _22, _23, _31, _32, _33) -> None: ...
  31. @overload
  32. def __init__(self, a: list[list]): ...
  33. def set_zeros(self) -> None: ...
  34. def set_ones(self) -> None: ...
  35. def set_identity(self) -> None: ...
  36. def copy(self) -> mat3x3: ...
  37. def __getitem__(self, index: tuple[int, int]) -> float: ...
  38. def __setitem__(self, index: tuple[int, int], value: float) -> None: ...
  39. def __add__(self, other: mat3x3) -> mat3x3: ...
  40. def __sub__(self, other: mat3x3) -> mat3x3: ...
  41. def __mul__(self, other: float) -> mat3x3: ...
  42. def __truediv__(self, other: float) -> mat3x3: ...
  43. def __matmul__(self, other: mat3x3) -> mat3x3: ...
  44. def matmul(self, other: mat3x3) -> mat3x3: ...
  45. def determinant(self) -> float: ...
  46. def transpose(self) -> mat3x3: ...
  47. def inverse(self) -> mat3x3: ...
  48. @staticmethod
  49. def zeros() -> mat3x3: ...
  50. @staticmethod
  51. def ones() -> mat3x3: ...
  52. @staticmethod
  53. def identity() -> mat3x3: ...
  54. # affine transformations
  55. @staticmethod
  56. def translate(v: vec2) -> mat3x3: ...
  57. @staticmethod
  58. def rotate(rad: float) -> mat3x3: ...
  59. @staticmethod
  60. def scale(v: vec2) -> mat3x3: ...
  61. @staticmethod
  62. def trs(t: vec2, r: float, s: vec2) -> mat3x3: ...
  63. @staticmethod
  64. def ortho(left: float, right: float, bottom: float, top: float) -> mat3x3: ...
  65. def is_affine(self) -> bool: ...
  66. def inverse_affine(self) -> mat3x3: ...
  67. def matmul_affine(self, other: mat3x3) -> mat3x3: ...
  68. def translation(self) -> vec2: ...
  69. def rotation(self) -> float: ...
  70. def scale(self) -> vec2: ...
  71. def transform_point(self, p: vec2) -> vec2: ...
  72. def transform_vector(self, v: vec2) -> vec2: ...