diff options
Diffstat (limited to 'src/types')
-rw-r--r-- | src/types/PointArray.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/types/PointArray.js b/src/types/PointArray.js index 9e7406d..6488c29 100644 --- a/src/types/PointArray.js +++ b/src/types/PointArray.js @@ -71,6 +71,20 @@ extend(PointArray, { return points }, + // transform points with matrix (similar to Point.transform) + transform (m) { + let points = [] + + for (let point of this) { + // Perform the matrix multiplication + points.push([m.a * point.x + m.c * point.y + m.e, + m.b * point.x + m.d * point.y + m.f]) + } + + // Return the required point + return new PointArray(points) + } + // Move point string move (x, y) { var box = this.bbox() |