linalg.pyi 4.8 KB

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