summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/types/PointArray.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/types/PointArray.js b/src/types/PointArray.js
index 9e7406d..2246bbd 100644
--- a/src/types/PointArray.js
+++ b/src/types/PointArray.js
@@ -71,6 +71,23 @@ extend(PointArray, {
return points
},
+ // transform points with matrix (similar to Point.transform)
+ transform (m) {
+ const points = []
+
+ for (let i = 0; i < this.length; i++) {
+ const point = this[i]
+ // Perform the matrix multiplication
+ points.push([
+ m.a * point[0] + m.c * point[1] + m.e,
+ m.b * point[0] + m.d * point[1] + m.f
+ ])
+ }
+
+ // Return the required point
+ return new PointArray(points)
+ },
+
// Move point string
move (x, y) {
var box = this.bbox()