diff --git a/buildconfig/stubs/pygame/math.pyi b/buildconfig/stubs/pygame/math.pyi index 82ec91c7a0..963f2bd957 100644 --- a/buildconfig/stubs/pygame/math.pyi +++ b/buildconfig/stubs/pygame/math.pyi @@ -333,8 +333,8 @@ class Vector3(_GenericVector): def update(self, x: int, y: int, z: int) -> None: ... -def lerp(a: float, b: float, weight: float, do_clamp: bool = True, /) -> float: ... -def invlerp(a: float, b: float, weight: float, /) -> float: ... +def lerp(a: float, b: float, value: float, do_clamp: bool = True, /) -> float: ... +def invlerp(a: float, b: float, value: float, /) -> float: ... def remap(i_min: float, i_max: float, o_min: float, o_max: float, value: float, /) -> float: ... def smoothstep(a: float, b: float, weight: float, /) -> float: ... diff --git a/docs/reST/ref/math.rst b/docs/reST/ref/math.rst index 93cb998bbc..4d93a46667 100644 --- a/docs/reST/ref/math.rst +++ b/docs/reST/ref/math.rst @@ -88,7 +88,7 @@ Multiple coordinates can be set using slices or swizzling and ``b``. The third parameter ``value`` is the result of the linear interpolation between a and b with a certain coefficient. In other words, this coefficient will be the result of this function. - If ``b - a`` is equal to 0, it raises a ``ZeroDivisionError``. + If ``b`` and ``a`` are equal, it raises a ``ValueError``. The formula is: @@ -135,12 +135,12 @@ Multiple coordinates can be set using slices or swizzling .. function:: remap - | :sl:`remaps value from i_range to o_range` + | :sl:`remaps value from given input range to given output range` | :sg:`remap(i_min, i_max, o_min, o_max, value, /) -> float` - Returns a number which is the value remapped from ``i_range`` to - ``o_range``. - If ``i_max - i_min`` is equal to 0, it raises a ``ZeroDivisionError``. + Returns a number which is the value remapped from ``[i_min, i_max]`` range to + ``[o_min, o_max]`` range. + If ``i_min`` and ``i_max`` are equal, it raises a ``ValueError``. Example: diff --git a/src_c/doc/math_doc.h b/src_c/doc/math_doc.h index f5607ce918..e002a0c672 100644 --- a/src_c/doc/math_doc.h +++ b/src_c/doc/math_doc.h @@ -4,7 +4,7 @@ #define DOC_MATH_LERP "lerp(a, b, value, do_clamp=True, /) -> float\nreturns value linearly interpolated between a and b" #define DOC_MATH_INVLERP "invlerp(a, b, value, /) -> float\nreturns value inverse interpolated between a and b" #define DOC_MATH_SMOOTHSTEP "smoothstep(a, b, value, /) -> float\nreturns value smoothly interpolated between a and b." -#define DOC_MATH_REMAP "remap(i_min, i_max, o_min, o_max, value, /) -> float\nremaps value from i_range to o_range" +#define DOC_MATH_REMAP "remap(i_min, i_max, o_min, o_max, value, /) -> float\nremaps value from given input range to given output range" #define DOC_MATH_VECTOR2 "Vector2() -> Vector2(0, 0)\nVector2(int) -> Vector2\nVector2(float) -> Vector2\nVector2(Vector2) -> Vector2\nVector2(x, y) -> Vector2\nVector2((x, y)) -> Vector2\na 2-Dimensional Vector" #define DOC_MATH_VECTOR2_DOT "dot(Vector2, /) -> float\ncalculates the dot- or scalar-product with the other vector" #define DOC_MATH_VECTOR2_CROSS "cross(Vector2, /) -> float\ncalculates the cross- or vector-product"