mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
136 lines
3.7 KiB
Python
136 lines
3.7 KiB
Python
from typing import overload
|
|
|
|
class vec2:
|
|
ZERO = vec2(0, 0)
|
|
ONE = vec2(1, 1)
|
|
|
|
@property
|
|
def x(self) -> float: ...
|
|
@property
|
|
def y(self) -> float: ...
|
|
|
|
def with_x(self, x: float) -> vec2: ...
|
|
def with_y(self, y: float) -> vec2: ...
|
|
|
|
def __init__(self, x: float, y: float) -> None: ...
|
|
def __repr__(self) -> str: ...
|
|
|
|
def __add__(self, other: vec2) -> vec2: ...
|
|
def __sub__(self, other: vec2) -> vec2: ...
|
|
@overload
|
|
def __mul__(self, other: float) -> vec2: ...
|
|
@overload
|
|
def __mul__(self, other: vec2) -> vec2: ...
|
|
def __truediv__(self, other: float) -> vec2: ...
|
|
|
|
def dot(self, other: vec2) -> float: ...
|
|
def cross(self, other: vec2) -> float: ...
|
|
def length(self) -> float: ...
|
|
def length_squared(self) -> float: ...
|
|
def normalize(self) -> vec2: ...
|
|
def rotate(self, radians: float) -> vec2: ...
|
|
|
|
@staticmethod
|
|
def angle(__from: vec2, __to: vec2) -> float:
|
|
"""Returns the angle in radians between vectors `from` and `to`.
|
|
|
|
The result range is `[-pi, pi]`.
|
|
|
|
+ if y axis is top to bottom, positive value means clockwise
|
|
+ if y axis is bottom to top, positive value means counter-clockwise
|
|
"""
|
|
|
|
@staticmethod
|
|
def smooth_damp(current: vec2, target: vec2, current_velocity: vec2, smooth_time: float, max_speed: float, delta_time: float) -> tuple[vec2, vec2]:
|
|
"""Smoothly changes a vector towards a desired goal over time.
|
|
|
|
Returns a new value that is closer to the target and current velocity.
|
|
"""
|
|
|
|
|
|
class mat3x3:
|
|
def __init__(self, _11, _12, _13, _21, _22, _23, _31, _32, _33) -> None: ...
|
|
def __repr__(self) -> str: ...
|
|
|
|
def __getitem__(self, index: tuple[int, int]) -> float: ...
|
|
def __setitem__(self, index: tuple[int, int], value: float) -> None: ...
|
|
|
|
@overload
|
|
def __matmul__(self, other: mat3x3) -> mat3x3: ...
|
|
@overload
|
|
def __matmul__(self, other: vec3) -> vec3: ...
|
|
|
|
def __invert__(self) -> mat3x3: ...
|
|
|
|
def matmul(self, other: mat3x3, out: mat3x3 = None) -> mat3x3 | None: ...
|
|
def determinant(self) -> float: ...
|
|
|
|
def copy(self) -> mat3x3: ...
|
|
def inverse(self) -> mat3x3: ...
|
|
|
|
def copy_(self, other: mat3x3) -> None: ...
|
|
def inverse_(self) -> None: ...
|
|
|
|
@staticmethod
|
|
def zeros() -> mat3x3: ...
|
|
@staticmethod
|
|
def identity() -> mat3x3: ...
|
|
|
|
# affine transformations
|
|
@staticmethod
|
|
def trs(t: vec2, r: float, s: vec2) -> mat3x3: ...
|
|
|
|
def copy_trs_(self, t: vec2, r: float, s: vec2) -> None: ...
|
|
|
|
def t(self) -> vec2: ...
|
|
def r(self) -> float: ...
|
|
def s(self) -> vec2: ...
|
|
|
|
def transform_point(self, p: vec2) -> vec2: ...
|
|
def transform_vector(self, v: vec2) -> vec2: ...
|
|
|
|
|
|
class vec2i:
|
|
@property
|
|
def x(self) -> int: ...
|
|
@property
|
|
def y(self) -> int: ...
|
|
|
|
def with_x(self, x: int) -> vec2i: ...
|
|
def with_y(self, y: int) -> vec2i: ...
|
|
|
|
def __init__(self, x: int, y: int) -> None: ...
|
|
def __repr__(self) -> str: ...
|
|
|
|
|
|
class vec3i:
|
|
@property
|
|
def x(self) -> int: ...
|
|
@property
|
|
def y(self) -> int: ...
|
|
@property
|
|
def z(self) -> int: ...
|
|
|
|
def with_x(self, x: int) -> vec3i: ...
|
|
def with_y(self, y: int) -> vec3i: ...
|
|
def with_z(self, z: int) -> vec3i: ...
|
|
|
|
def __init__(self, x: int, y: int, z: int) -> None: ...
|
|
def __repr__(self) -> str: ...
|
|
|
|
|
|
class vec3:
|
|
@property
|
|
def x(self) -> float: ...
|
|
@property
|
|
def y(self) -> float: ...
|
|
@property
|
|
def z(self) -> float: ...
|
|
|
|
def with_x(self, x: float) -> vec3: ...
|
|
def with_y(self, y: float) -> vec3: ...
|
|
def with_z(self, z: float) -> vec3: ...
|
|
|
|
def __init__(self, x: float, y: float, z: float) -> None: ...
|
|
def __repr__(self) -> str: ...
|