| 120 | return self.transform(((1, 0, 0), (t, 1, 0), (0, 0, 1))) |
| 121 | |
| 122 | def transform(self, other=None, offset=None): |
| 123 | if isinstance(other, Transform3D): |
| 124 | assert offset is None |
| 125 | other, offset = other.matrix, other.offset |
| 126 | |
| 127 | x, y, z = self.offset |
| 128 | |
| 129 | if offset is not None: |
| 130 | dx, dy, dz = _dotProduct([offset], self.matrix)[0] |
| 131 | x += dx |
| 132 | y += dy |
| 133 | z += dz |
| 134 | |
| 135 | if other: |
| 136 | matrix = _dotProduct(other, self.matrix) |
| 137 | else: |
| 138 | matrix = self.matrix |
| 139 | |
| 140 | return self.__class__(matrix, (x, y, z)) |
| 141 | |
| 142 | def transformPoint(self, pt): |
| 143 | return self.transformPoints([pt])[0] |