linalg.pyi 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 vec4:
  33. x: float
  34. y: float
  35. z: float
  36. w: float
  37. def __init__(self, x: float, y: float, z: float, w: float) -> None: ...
  38. def copy(self) -> vec4: ...
  39. def __add__(self, other: vec4) -> vec4: ...
  40. def __sub__(self, other: vec4) -> vec4: ...
  41. def __mul__(self, other: float) -> vec4: ...
  42. def __truediv__(self, other: float) -> vec4: ...
  43. def dot(self, other: vec4) -> float: ...
  44. def length(self) -> float: ...
  45. def length_squared(self) -> float: ...
  46. def normalize(self) -> vec4: ...
  47. class mat3x3:
  48. _11: float
  49. _12: float
  50. _13: float
  51. _21: float
  52. _22: float
  53. _23: float
  54. _31: float
  55. _32: float
  56. _33: float
  57. @overload
  58. def __init__(self) -> None: ...
  59. @overload
  60. def __init__(self, _11, _12, _13, _21, _22, _23, _31, _32, _33) -> None: ...
  61. @overload
  62. def __init__(self, a: list[list]): ...
  63. def set_zeros(self) -> None: ...
  64. def set_ones(self) -> None: ...
  65. def set_identity(self) -> None: ...
  66. def copy(self) -> mat3x3: ...
  67. def __getitem__(self, index: tuple[int, int]) -> float: ...
  68. def __setitem__(self, index: tuple[int, int], value: float) -> None: ...
  69. def __add__(self, other: mat3x3) -> mat3x3: ...
  70. def __sub__(self, other: mat3x3) -> mat3x3: ...
  71. def __mul__(self, other: float) -> mat3x3: ...
  72. def __truediv__(self, other: float) -> mat3x3: ...
  73. @overload
  74. def __matmul__(self, other: mat3x3) -> mat3x3: ...
  75. @overload
  76. def __matmul__(self, other: vec3) -> vec3: ...
  77. @overload
  78. def matmul(self, other: mat3x3) -> mat3x3: ...
  79. @overload
  80. def matmul(self, other: vec3) -> vec3: ...
  81. def determinant(self) -> float: ...
  82. def transpose(self) -> mat3x3: ...
  83. def inverse(self) -> mat3x3: ...
  84. @staticmethod
  85. def zeros() -> mat3x3: ...
  86. @staticmethod
  87. def ones() -> mat3x3: ...
  88. @staticmethod
  89. def identity() -> mat3x3: ...
  90. # affine transformations
  91. @staticmethod
  92. def trs(t: vec2, r: float, s: vec2) -> mat3x3: ...
  93. def is_affine(self) -> bool: ...
  94. def inverse_affine(self) -> mat3x3: ...
  95. def matmul_affine(self, other: mat3x3) -> mat3x3: ...
  96. def translation(self) -> vec2: ...
  97. def rotation(self) -> float: ...
  98. def scale(self) -> vec2: ...
  99. def transform_point(self, p: vec2) -> vec2: ...
  100. def transform_vector(self, v: vec2) -> vec2: ...