From 77209eb2852ed519a2e823a2fa1edb6bc7a44b75 Mon Sep 17 00:00:00 2001 From: shBLOCK <50770712+shBLOCK@users.noreply.github.com> Date: Sun, 7 Apr 2024 14:29:12 +0800 Subject: [PATCH] v1.5.2: Fix incorrect docstrings. --- codegen/templates/transform_2d.pyx | 15 ++++++++++++--- codegen/templates/transform_3d.pyx | 15 ++++++++++++--- codegen/templates/vec_class.pyx | 16 ++++++++++++++-- pyproject.toml | 2 +- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/codegen/templates/transform_2d.pyx b/codegen/templates/transform_2d.pyx index e0a5637..fcd7914 100644 --- a/codegen/templates/transform_2d.pyx +++ b/codegen/templates/transform_2d.pyx @@ -254,7 +254,10 @@ cdef class Transform2D: return self.tdoty(x, y) + self.oy def __mul__(self, Vec2 other) -> Vec2: - """Transform a copy of the vector.""" + """Transform a copy of the vector. + + See Also: `Vec2.__mul__()` + """ cdef Vec2 vec = Vec2.__new__(Vec2) vec.x = self.mulx(other.x, other.y) vec.y = self.muly(other.x, other.y) @@ -262,7 +265,10 @@ cdef class Transform2D: # cdef inline Vec2 __call__(self, Vec2 other): - """Transform a copy of the vector.""" + """Transform a copy of the vector. + + See Also: `Vec2.__mul__()` + """ cdef Vec2 vec = Vec2.__new__(Vec2) vec.x = self.mulx(other.x, other.y) vec.y = self.muly(other.x, other.y) @@ -316,7 +322,10 @@ cdef class Transform2D: return self._determinant() def __invert__(self) -> Transform2D: - """Get the invert transform.""" + """Get the invert transform. + + See Also: `Vec2.__mul__()` + """ cdef py_float i_det = 1.0 / self._determinant() cdef Transform2D t = Transform2D.__new__(Transform2D) t.xx = self.yy * +i_det diff --git a/codegen/templates/transform_3d.pyx b/codegen/templates/transform_3d.pyx index 50da5da..12c54d2 100644 --- a/codegen/templates/transform_3d.pyx +++ b/codegen/templates/transform_3d.pyx @@ -365,7 +365,10 @@ cdef class Transform3D: return self.tdotz(x, y, z) + self.oz def __mul__(self, Vec3 other) -> Vec3: - """Transform a copy of the vector.""" + """Transform a copy of the vector. + + See Also: `Vec3.__mul__()` + """ cdef Vec3 vec = Vec3.__new__(Vec3) vec.x = self.mulx(other.x, other.y, other.z) vec.y = self.muly(other.x, other.y, other.z) @@ -374,7 +377,10 @@ cdef class Transform3D: # cdef inline Vec3 __call__(self, Vec3 other): - """Transform a copy of the vector.""" + """Transform a copy of the vector. + + See Also: `Vec3.__mul__()` + """ cdef Vec3 vec = Vec3.__new__(Vec3) vec.x = self.mulx(other.x, other.y, other.z) vec.y = self.muly(other.x, other.y, other.z) @@ -450,7 +456,10 @@ cdef class Transform3D: return self._determinant() def __invert__(self) -> Transform3D: - """Get the invert transform.""" + """Get the invert transform. + + See Also: `Vec3.__mul__()` + """ cdef py_float cox = self.yy * self.zz - self.yz * self.zy cdef py_float coy = self.xz * self.zy - self.xy * self.zz cdef py_float coz = self.xy * self.yz - self.yy * self.xz diff --git a/codegen/templates/vec_class.pyx b/codegen/templates/vec_class.pyx index 0de94a7..28c7464 100644 --- a/codegen/templates/vec_class.pyx +++ b/codegen/templates/vec_class.pyx @@ -121,7 +121,13 @@ cdef class _VecClassName_: #: _Dims_ == 2 # cdef inline Vec2 __mul__(self, Transform2D t): - """Transform a copy of this vector using the `Transform2D`.""" + """Transform a copy of this vector using the *INVERSE* of the transform. + Use `transform * vector` or `transform(vector)` for non-inverse transformation. + + See Also: + `Transform2D.__mul__()` + `Transform2D.__call__()` + """ cdef Vec2 vec = Vec2.__new__(Vec2) cdef py_float x = self.x - t.ox cdef py_float y = self.y - t.oy @@ -132,7 +138,13 @@ cdef class _VecClassName_: #: _Dims_ == 3 # cdef inline Vec3 __mul__(self, Transform3D t): - """Transform a copy of this vector using the `Transform3D`.""" + """Transform a copy of this vector using the *INVERSE* of the transform. + Use `transform * vector` or `transform(vector)` for non-inverse transformation. + + See Also: + `Transform3D.__mul__()` + `Transform3D.__call__()` + """ cdef Vec3 vec = Vec3.__new__(Vec3) cdef py_float x = self.x - t.ox cdef py_float y = self.y - t.oy diff --git a/pyproject.toml b/pyproject.toml index f5cbf08..02965e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = ["setuptools", "cython"] [project] name = "gdmath" -version = "1.5.1" +version = "1.5.2" description = "GdMath: a fast math library for game development" readme = "README.md" requires-python = ">= 3.9"