linalg.pyi 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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) -> vec2: ...
  16. def rotate(self, radians: float) -> vec2: ...
  17. class vec3:
  18. x: float
  19. y: float
  20. z: float
  21. def __init__(self, x: float, y: float, z: float) -> None: ...
  22. def copy(self) -> vec3: ...
  23. def __add__(self, other: vec3) -> vec3: ...
  24. def __sub__(self, other: vec3) -> vec3: ...
  25. def __mul__(self, other: float) -> vec3: ...
  26. def __truediv__(self, other: float) -> vec3: ...
  27. def dot(self, other: vec3) -> float: ...
  28. def cross(self, other: vec3) -> float: ...
  29. def length(self) -> float: ...
  30. def length_squared(self) -> float: ...
  31. def normalize(self) -> vec3: ...
  32. class mat3x3:
  33. _11: float
  34. _12: float
  35. _13: float
  36. _21: float
  37. _22: float
  38. _23: float
  39. _31: float
  40. _32: float
  41. _33: float
  42. @overload
  43. def __init__(self) -> None: ...
  44. @overload
  45. def __init__(self, _11, _12, _13, _21, _22, _23, _31, _32, _33) -> None: ...
  46. @overload
  47. def __init__(self, a: list[list]): ...
  48. def set_zeros(self) -> None: ...
  49. def set_ones(self) -> None: ...
  50. def set_identity(self) -> None: ...
  51. def copy(self) -> mat3x3: ...
  52. def __getitem__(self, index: tuple[int, int]) -> float: ...
  53. def __setitem__(self, index: tuple[int, int], value: float) -> None: ...
  54. def __add__(self, other: mat3x3) -> mat3x3: ...
  55. def __sub__(self, other: mat3x3) -> mat3x3: ...
  56. def __mul__(self, other: float) -> mat3x3: ...
  57. def __truediv__(self, other: float) -> mat3x3: ...
  58. @overload
  59. def __matmul__(self, other: mat3x3) -> mat3x3: ...
  60. @overload
  61. def __matmul__(self, other: vec3) -> vec3: ...
  62. @overload
  63. def matmul(self, other: mat3x3) -> mat3x3: ...
  64. @overload
  65. def matmul(self, other: vec3) -> vec3: ...
  66. def determinant(self) -> float: ...
  67. def transpose(self) -> mat3x3: ...
  68. def inverse(self) -> mat3x3: ...
  69. @staticmethod
  70. def zeros() -> mat3x3: ...
  71. @staticmethod
  72. def ones() -> mat3x3: ...
  73. @staticmethod
  74. def identity() -> mat3x3: ...
  75. # affine transformations
  76. @staticmethod
  77. def trs(t: vec2, r: float, s: vec2) -> mat3x3: ...
  78. def is_affine(self) -> bool: ...
  79. def inverse_affine(self) -> mat3x3: ...
  80. def matmul_affine(self, other: mat3x3) -> mat3x3: ...
  81. def translation(self) -> vec2: ...
  82. def rotation(self) -> float: ...
  83. def scale(self) -> vec2: ...
  84. def transform_point(self, p: vec2) -> vec2: ...
  85. def transform_vector(self, v: vec2) -> vec2: ...