linalg.pyi 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 __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. def rotate_(self, radians: float) -> None: ...
  18. class vec3(_StructLike['vec3']):
  19. x: float
  20. y: float
  21. z: float
  22. def __init__(self, x: float, y: float, z: float) -> None: ...
  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(_StructLike['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 __add__(self, other: vec4) -> vec4: ...
  39. def __sub__(self, other: vec4) -> vec4: ...
  40. def __mul__(self, other: float) -> vec4: ...
  41. def __truediv__(self, other: float) -> vec4: ...
  42. def dot(self, other: vec4) -> float: ...
  43. def length(self) -> float: ...
  44. def length_squared(self) -> float: ...
  45. def normalize(self) -> vec4: ...
  46. class mat3x3(_StructLike['mat3x3']):
  47. _11: float
  48. _12: float
  49. _13: float
  50. _21: float
  51. _22: float
  52. _23: float
  53. _31: float
  54. _32: float
  55. _33: float
  56. @overload
  57. def __init__(self) -> None: ...
  58. @overload
  59. def __init__(self, _11, _12, _13, _21, _22, _23, _31, _32, _33) -> None: ...
  60. @overload
  61. def __init__(self, a: list[list]): ...
  62. def set_zeros(self) -> None: ...
  63. def set_ones(self) -> None: ...
  64. def set_identity(self) -> None: ...
  65. def determinant(self) -> float: ...
  66. def transpose(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. def __invert__(self) -> mat3x3: ...
  74. @overload
  75. def __matmul__(self, other: mat3x3) -> mat3x3: ...
  76. @overload
  77. def __matmul__(self, other: vec3) -> vec3: ...
  78. @staticmethod
  79. def zeros() -> mat3x3: ...
  80. @staticmethod
  81. def ones() -> mat3x3: ...
  82. @staticmethod
  83. def identity() -> mat3x3: ...
  84. # affine transformations
  85. @staticmethod
  86. def trs(t: vec2, r: float, s: vec2) -> mat3x3: ...
  87. def is_affine(self) -> bool: ...
  88. def _t(self) -> vec2: ...
  89. def _r(self) -> float: ...
  90. def _s(self) -> vec2: ...
  91. def transform_point(self, p: vec2) -> vec2: ...
  92. def transform_vector(self, v: vec2) -> vec2: ...
  93. vec2_p = float_p
  94. vec3_p = float_p
  95. vec4_p = float_p
  96. mat3x3_p = float_p