1
0

linalg.pyi 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. from typing import overload
  2. from c import _StructLike, float_p
  3. class vec2(_StructLike['vec2']):
  4. x: float
  5. y: float
  6. ZERO: 'vec2' = ...
  7. ONE: 'vec2' = ...
  8. def __init__(self, x: float, y: float) -> None: ...
  9. def __add__(self, other: vec2) -> vec2: ...
  10. def __sub__(self, other: vec2) -> vec2: ...
  11. def __getitem__(self, index: int) -> float: ...
  12. @overload
  13. def __mul__(self, other: float) -> vec2: ...
  14. @overload
  15. def __mul__(self, other: vec2) -> vec2: ...
  16. def __rmul__(self, other: float) -> vec2: ...
  17. def __truediv__(self, other: float) -> vec2: ...
  18. def dot(self, other: vec2) -> float: ...
  19. def cross(self, other: vec2) -> float: ...
  20. def length(self) -> float: ...
  21. def length_squared(self) -> float: ...
  22. def normalize(self) -> vec2: ...
  23. def rotate(self, radians: float) -> vec2: ...
  24. def copy_(self, other: vec2) -> None: ...
  25. def normalize_(self) -> None: ...
  26. def rotate_(self, radians: float) -> None: ...
  27. @staticmethod
  28. def angle(__from: vec2, __to: vec2) -> float:
  29. """Returns the angle in radians between vectors `from` and `to`.
  30. The result range is `[-pi, pi]`.
  31. + if y axis is top to bottom, positive value means clockwise
  32. + if y axis is bottom to top, positive value means counter-clockwise
  33. """
  34. @staticmethod
  35. def smooth_damp(current: vec2, target: vec2, current_velocity_: vec2, smooth_time: float, max_speed: float, delta_time: float) -> vec2:
  36. ...
  37. class vec3(_StructLike['vec3']):
  38. x: float
  39. y: float
  40. z: float
  41. ZERO: 'vec3' = ...
  42. ONE: 'vec3' = ...
  43. def __init__(self, x: float, y: float, z: float) -> None: ...
  44. def __add__(self, other: vec3) -> vec3: ...
  45. def __sub__(self, other: vec3) -> vec3: ...
  46. def __getitem__(self, index: int) -> float: ...
  47. @overload
  48. def __mul__(self, other: float) -> vec3: ...
  49. @overload
  50. def __mul__(self, other: vec3) -> vec3: ...
  51. def __rmul__(self, other: float) -> vec3: ...
  52. def __truediv__(self, other: float) -> vec3: ...
  53. def dot(self, other: vec3) -> float: ...
  54. def cross(self, other: vec3) -> float: ...
  55. def length(self) -> float: ...
  56. def length_squared(self) -> float: ...
  57. def normalize(self) -> vec3: ...
  58. def copy_(self, other: vec3) -> None: ...
  59. def normalize_(self) -> None: ...
  60. class vec4(_StructLike['vec4']):
  61. x: float
  62. y: float
  63. z: float
  64. w: float
  65. ZERO: 'vec4' = ...
  66. ONE: 'vec4' = ...
  67. def __init__(self, x: float, y: float, z: float, w: float) -> None: ...
  68. def __add__(self, other: vec4) -> vec4: ...
  69. def __sub__(self, other: vec4) -> vec4: ...
  70. def __getitem__(self, index: int) -> float: ...
  71. @overload
  72. def __mul__(self, other: float) -> vec4: ...
  73. @overload
  74. def __mul__(self, other: vec4) -> vec4: ...
  75. def __rmul__(self, other: float) -> vec4: ...
  76. def __truediv__(self, other: float) -> vec4: ...
  77. def dot(self, other: vec4) -> float: ...
  78. def length(self) -> float: ...
  79. def length_squared(self) -> float: ...
  80. def normalize(self) -> vec4: ...
  81. def copy_(self, other: vec4) -> None: ...
  82. def normalize_(self) -> None: ...
  83. class mat3x3(_StructLike['mat3x3']):
  84. _11: float
  85. _12: float
  86. _13: float
  87. _21: float
  88. _22: float
  89. _23: float
  90. _31: float
  91. _32: float
  92. _33: float
  93. @overload
  94. def __init__(self) -> None: ...
  95. @overload
  96. def __init__(self, _11, _12, _13, _21, _22, _23, _31, _32, _33) -> None: ...
  97. @overload
  98. def __init__(self, a: list[float]): ...
  99. def determinant(self) -> float: ...
  100. def inverse(self) -> mat3x3: ...
  101. def transpose(self) -> mat3x3: ...
  102. def __getitem__(self, index: tuple[int, int]) -> float: ...
  103. def __setitem__(self, index: tuple[int, int], value: float) -> None: ...
  104. def __add__(self, other: mat3x3) -> mat3x3: ...
  105. def __sub__(self, other: mat3x3) -> mat3x3: ...
  106. def __mul__(self, other: float) -> mat3x3: ...
  107. def __rmul__(self, other: float) -> mat3x3: ...
  108. def __truediv__(self, other: float) -> mat3x3: ...
  109. def __invert__(self) -> mat3x3: ...
  110. @overload
  111. def __matmul__(self, other: mat3x3) -> mat3x3: ...
  112. @overload
  113. def __matmul__(self, other: vec3) -> vec3: ...
  114. def matmul(self, other: mat3x3, out: mat3x3 = None) -> mat3x3 | None: ...
  115. def copy_(self, other: mat3x3) -> None: ...
  116. def inverse_(self) -> None: ...
  117. def transpose_(self) -> None: ...
  118. @staticmethod
  119. def zeros() -> mat3x3: ...
  120. @staticmethod
  121. def ones() -> mat3x3: ...
  122. @staticmethod
  123. def identity() -> mat3x3: ...
  124. # affine transformations
  125. @staticmethod
  126. def trs(t: vec2, r: float, s: vec2) -> mat3x3: ...
  127. def copy_trs_(self, t: vec2, r: float, s: vec2) -> None: ...
  128. def copy_t_(self, t: vec2) -> None: ...
  129. def copy_r_(self, r: float) -> None: ...
  130. def copy_s_(self, s: vec2) -> None: ...
  131. def _t(self) -> vec2: ...
  132. def _r(self) -> float: ...
  133. def _s(self) -> vec2: ...
  134. def is_affine(self) -> bool: ...
  135. def transform_point(self, p: vec2) -> vec2: ...
  136. def transform_vector(self, v: vec2) -> vec2: ...
  137. def inverse_transform_point(self, p: vec2) -> vec2: ...
  138. def inverse_transform_vector(self, v: vec2) -> vec2: ...
  139. vec2_p = float_p
  140. vec3_p = float_p
  141. vec4_p = float_p
  142. mat3x3_p = float_p