Skip to content

Commit 1a408af

Browse files
committed
remove no-longer used decomposeMatrix function
1 parent 85d6ccc commit 1a408af

1 file changed

Lines changed: 0 additions & 27 deletions

File tree

src/math/trigonometry.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -204,33 +204,6 @@ function trigonometry(p5, fn){
204204
return this._fromRadians(Math.asin(ratio));
205205
};
206206

207-
fn.decomposeMatrix = function(mat) {
208-
// adapted from https://frederic-wang.fr/2013/12/01/decomposition-of-2d-transform-matrices/
209-
let { a, b, c, d, e, f } = mat;
210-
let delta = a * d - b * c;
211-
let result = {
212-
translation: { x: e, y: f },
213-
scale: { x: 0, y: 0 },
214-
shear: { x: 0, y: 0 },
215-
rotation: 0
216-
};
217-
if (a !== 0 || b !== 0) {
218-
let r = Math.sqrt(a * a + b * b);
219-
result.rotation = b > 0 ? Math.acos(a / r) : -Math.acos(a / r);
220-
result.scale = { x: r, y: delta / r };
221-
result.shear = { x: Math.atan((a * c + b * d) / (r * r)), y: 0 };
222-
} else if (c !== 0 || d !== 0) {
223-
let s = Math.sqrt(c * c + d * d);
224-
result.rotation = Math.PI / 2 -
225-
(d > 0 ? Math.acos(-c / s) : -Math.acos(c / s));
226-
result.scale = { x: delta / s, y: s };
227-
result.shear = { x: 0, y: Math.atan((a * c + b * d) / (s * s)) };
228-
} else {
229-
// a = b = c = d = 0
230-
}
231-
return result;
232-
};
233-
234207
/**
235208
* Calculates the arc tangent of a number.
236209
*

0 commit comments

Comments
 (0)