Translate translates m by the point (x, y).
(x, y float32)
| 197 | |
| 198 | // Translate translates m by the point (x, y). |
| 199 | func (m *Matrix) Translate(x, y float32) *Matrix { |
| 200 | m.tmp[m00] = 1 |
| 201 | m.tmp[m10] = 0 |
| 202 | m.tmp[m20] = 0 |
| 203 | |
| 204 | m.tmp[m01] = 0 |
| 205 | m.tmp[m11] = 1 |
| 206 | m.tmp[m21] = 0 |
| 207 | |
| 208 | m.tmp[m02] = x |
| 209 | m.tmp[m12] = y |
| 210 | m.tmp[m22] = 1 |
| 211 | |
| 212 | multiplyMatricies(m.Val[:], m.tmp[:]) |
| 213 | return m |
| 214 | } |
| 215 | |
| 216 | // TranslatePoint translates m by the point p. |
| 217 | func (m *Matrix) TranslatePoint(p Point) *Matrix { |