Skip to content

Commit

Permalink
v1.4.1: Fix inplace matmul operators of transforms not returning it s…
Browse files Browse the repository at this point in the history
…elf.
  • Loading branch information
shBLOCK committed Oct 6, 2023
1 parent fdc36b3 commit a446cdf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion codegen/templates/transform_2d.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,14 @@ cdef class Transform2D:
t.oy = self.muly(other.ox, other.oy)
return t

def __imatmul__(self, Transform2D other) -> None:
def __imatmul__(self, Transform2D other) -> Transform2D:
self.xx = other.tdotx(self.xx, self.xy)
self.xy = other.tdoty(self.xx, self.xy)
self.yx = other.tdotx(self.yx, self.yy)
self.yy = other.tdoty(self.yx, self.yy)
self.ox = other.mulx(self.ox, self.oy)
self.oy = other.muly(self.ox, self.oy)
return self

cdef inline py_float _determinant(self) noexcept:
return self.xx * self.yy - self.xy * self.yx
Expand Down
3 changes: 2 additions & 1 deletion codegen/templates/transform_3d.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ cdef class Transform3D:
t.oz = self.mulz(other.ox, other.oy, other.oz)
return t

def __imatmul__(self, Transform3D other) -> None:
def __imatmul__(self, Transform3D other) -> Transform3D:
self.xx = other.tdotx(self.xx, self.xy, self.xz)
self.xy = other.tdoty(self.xx, self.xy, self.xz)
self.xz = other.tdotz(self.xx, self.xy, self.xz)
Expand All @@ -379,6 +379,7 @@ cdef class Transform3D:
self.ox = other.mulx(self.ox, self.oy, self.oz)
self.oy = other.muly(self.ox, self.oy, self.oz)
self.oz = other.mulz(self.ox, self.oy, self.oz)
return self

cdef inline py_float _determinant(self) noexcept:
return (self.xx * (self.yy * self.zz - self.yz * self.zy) -
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = ["setuptools", "cython"]

[project]
name = "gdmath"
version = "1.4.0"
version = "1.4.1"
description = "GdMath: a fast math library for game development"
readme = "README.md"
requires-python = ">= 3.9"
Expand Down

0 comments on commit a446cdf

Please sign in to comment.