From 034897f92ddeb08dd17f411727d3c77bee331f23 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 21 Feb 2025 14:54:18 +0800 Subject: [PATCH] fix docs --- include/typings/array2d.pyi | 6 +++--- include/typings/linalg.pyi | 15 ++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/typings/array2d.pyi b/include/typings/array2d.pyi index a04731c6..61589735 100644 --- a/include/typings/array2d.pyi +++ b/include/typings/array2d.pyi @@ -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: ... diff --git a/include/typings/linalg.pyi b/include/typings/linalg.pyi index 7a26a8db..936a9b04 100644 --- a/include/typings/linalg.pyi +++ b/include/typings/linalg.pyi @@ -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. """