Skip to content

Commit a446cdf

Browse files
committed
v1.4.1: Fix inplace matmul operators of transforms not returning it self.
1 parent fdc36b3 commit a446cdf

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

codegen/templates/transform_2d.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,14 @@ cdef class Transform2D:
245245
t.oy = self.muly(other.ox, other.oy)
246246
return t
247247

248-
def __imatmul__(self, Transform2D other) -> None:
248+
def __imatmul__(self, Transform2D other) -> Transform2D:
249249
self.xx = other.tdotx(self.xx, self.xy)
250250
self.xy = other.tdoty(self.xx, self.xy)
251251
self.yx = other.tdotx(self.yx, self.yy)
252252
self.yy = other.tdoty(self.yx, self.yy)
253253
self.ox = other.mulx(self.ox, self.oy)
254254
self.oy = other.muly(self.ox, self.oy)
255+
return self
255256

256257
cdef inline py_float _determinant(self) noexcept:
257258
return self.xx * self.yy - self.xy * self.yx

codegen/templates/transform_3d.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ cdef class Transform3D:
366366
t.oz = self.mulz(other.ox, other.oy, other.oz)
367367
return t
368368

369-
def __imatmul__(self, Transform3D other) -> None:
369+
def __imatmul__(self, Transform3D other) -> Transform3D:
370370
self.xx = other.tdotx(self.xx, self.xy, self.xz)
371371
self.xy = other.tdoty(self.xx, self.xy, self.xz)
372372
self.xz = other.tdotz(self.xx, self.xy, self.xz)
@@ -379,6 +379,7 @@ cdef class Transform3D:
379379
self.ox = other.mulx(self.ox, self.oy, self.oz)
380380
self.oy = other.muly(self.ox, self.oy, self.oz)
381381
self.oz = other.mulz(self.ox, self.oy, self.oz)
382+
return self
382383

383384
cdef inline py_float _determinant(self) noexcept:
384385
return (self.xx * (self.yy * self.zz - self.yz * self.zy) -

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = ["setuptools", "cython"]
44

55
[project]
66
name = "gdmath"
7-
version = "1.4.0"
7+
version = "1.4.1"
88
description = "GdMath: a fast math library for game development"
99
readme = "README.md"
1010
requires-python = ">= 3.9"

0 commit comments

Comments
 (0)