linalg.pyi 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. def __mul__(self, other: float) -> vec2: ...
  10. def __rmul__(self, other: float) -> vec2: ...
  11. def __truediv__(self, other: float) -> vec2: ...
  12. def dot(self, other: vec2) -> float: ...
  13. def cross(self, other: vec2) -> float: ...
  14. def length(self) -> float: ...
  15. def length_squared(self) -> float: ...
  16. def normalize(self) -> vec2: ...
  17. def rotate(self, radians: float) -> vec2: ...
  18. def rotate_(self, radians: float) -> None: ...
  19. class vec3(_StructLike['vec3']):
  20. x: float
  21. y: float
  22. z: float
  23. def __init__(self, x: float, y: float, z: float) -> None: ...
  24. def __add__(self, other: vec3) -> vec3: ...
  25. def __sub__(self, other: vec3) -> vec3: ...
  26. def __mul__(self, other: float) -> vec3: ...
  27. def __rmul__(self, other: float) -> vec3: ...
  28. def __truediv__(self, other: float) -> vec3: ...
  29. def dot(self, other: vec3) -> float: ...
  30. def cross(self, other: vec3) -> float: ...
  31. def length(self) -> float: ...
  32. def length_squared(self) -> float: ...
  33. def normalize(self) -> vec3: ...
  34. class vec4(_StructLike['vec4']):
  35. x: float
  36. y: float
  37. z: float
  38. w: float
  39. def __init__(self, x: float, y: float, z: float, w: float) -> None: ...
  40. def __add__(self, other: vec4) -> vec4: ...
  41. def __sub__(self, other: vec4) -> vec4: ...
  42. def __mul__(self, other: float) -> vec4: ...
  43. def __rmul__(self, other: float) -> vec4: ...
  44. def __truediv__(self, other: float) -> vec4: ...
  45. def dot(self, other: vec4) -> float: ...
  46. def length(self) -> float: ...
  47. def length_squared(self) -> float: ...
  48. def normalize(self) -> vec4: ...
  49. class mat3x3(_StructLike['mat3x3']):
  50. _11: float
  51. _12: float
  52. _13: float
  53. _21: float
  54. _22: float
  55. _23: float
  56. _31: float
  57. _32: float
  58. _33: float
  59. @overload
  60. def __init__(self) -> None: ...
  61. @overload
  62. def __init__(self, _11, _12, _13, _21, _22, _23, _31, _32, _33) -> None: ...
  63. @overload
  64. def __init__(self, a: list[list]): ...
  65. def set_zeros(self) -> None: ...
  66. def set_ones(self) -> None: ...
  67. def set_identity(self) -> None: ...
  68. def determinant(self) -> float: ...
  69. def transpose(self) -> mat3x3: ...
  70. def __getitem__(self, index: tuple[int, int]) -> float: ...
  71. def __setitem__(self, index: tuple[int, int], value: float) -> None: ...
  72. def __add__(self, other: mat3x3) -> mat3x3: ...
  73. def __sub__(self, other: mat3x3) -> mat3x3: ...
  74. def __mul__(self, other: float) -> mat3x3: ...
  75. def __rmul__(self, other: float) -> mat3x3: ...
  76. def __truediv__(self, other: float) -> mat3x3: ...
  77. def __invert__(self) -> mat3x3: ...
  78. @overload
  79. def __matmul__(self, other: mat3x3) -> mat3x3: ...
  80. @overload
  81. def __matmul__(self, other: vec3) -> vec3: ...
  82. @staticmethod
  83. def zeros() -> mat3x3: ...
  84. @staticmethod
  85. def ones() -> mat3x3: ...
  86. @staticmethod
  87. def identity() -> mat3x3: ...
  88. # affine transformations
  89. @staticmethod
  90. def trs(t: vec2, r: float, s: vec2) -> mat3x3: ...
  91. def is_affine(self) -> bool: ...
  92. def _t(self) -> vec2: ...
  93. def _r(self) -> float: ...
  94. def _s(self) -> vec2: ...
  95. def transform_point(self, p: vec2) -> vec2: ...
  96. def transform_vector(self, v: vec2) -> vec2: ...
  97. vec2_p = float_p
  98. vec3_p = float_p
  99. vec4_p = float_p
  100. mat3x3_p = float_p