linalg.pyi 4.3 KB

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