mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
fix docs
This commit is contained in:
parent
dc8df160d6
commit
034897f92d
@ -25,7 +25,7 @@ class array2d_like[T]:
|
||||
def get[R](self, col: int, row: int, default: R = None) -> T | R:
|
||||
"""Get the value at the given position.
|
||||
|
||||
If the position is out of bounds, return the default value.
|
||||
If the position is out of bounds, returns the default value.
|
||||
"""
|
||||
|
||||
def render(self) -> str: ...
|
||||
@ -100,7 +100,7 @@ class array2d_like[T]:
|
||||
"""Convolve the array with the given kernel."""
|
||||
|
||||
def get_connected_components(self, value: T, neighborhood: Neighborhood) -> tuple[array2d[int], int]:
|
||||
"""Get connected components of the grid.
|
||||
"""Get connected components of the grid via BFS algorithm.
|
||||
|
||||
Returns the `visited` array and the number of connected components,
|
||||
where `0` means unvisited, and non-zero means the index of the connected component.
|
||||
@ -144,7 +144,7 @@ class chunked_array2d[T, TContext]:
|
||||
def clear(self) -> None: ...
|
||||
|
||||
def world_to_chunk(self, world_pos: vec2i) -> tuple[vec2i, vec2i]:
|
||||
"""Convert world position to chunk position and local position."""
|
||||
"""Converts world position to chunk position and local position."""
|
||||
|
||||
def add_chunk(self, chunk_pos: vec2i) -> TContext: ...
|
||||
def remove_chunk(self, chunk_pos: vec2i) -> bool: ...
|
||||
|
@ -60,21 +60,26 @@ class vec2(_vecF['vec2']):
|
||||
@overload
|
||||
def __init__(self, xy: vec2i) -> None: ...
|
||||
|
||||
def rotate(self, radians: float) -> vec2: ...
|
||||
def rotate(self, radians: float) -> vec2:
|
||||
"""Rotate the vector by `radians`.
|
||||
|
||||
+ If y axis is top to bottom, positive value means clockwise (default)
|
||||
+ If y axis is bottom to top, positive value means counter-clockwise
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def angle(__from: vec2, __to: vec2) -> float:
|
||||
"""Returns the angle in radians between vectors `from` and `to`.
|
||||
"""Return 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
|
||||
+ If y axis is top to bottom, positive value means clockwise (default)
|
||||
+ 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.
|
||||
"""Smoothly change a vector towards a desired goal over time.
|
||||
|
||||
Returns a new value that is closer to the target and current velocity.
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user