File: /home/creaqbdc/public_html/wp-content/uploads/ac_assets/morph_slider/vendor/ogl/src/math/Euler.js
import * as EulerFunc from './functions/EulerFunc.js';
import { Mat4 } from './Mat4.js';
const tmpMat4 = new Mat4();
export class Euler extends Array {
constructor(x = 0, y = x, z = x, order = 'YXZ') {
super(x, y, z);
this.order = order;
this.onChange = () => {};
return this;
}
get x() {
return this[0];
}
get y() {
return this[1];
}
get z() {
return this[2];
}
set x(v) {
this[0] = v;
this.onChange();
}
set y(v) {
this[1] = v;
this.onChange();
}
set z(v) {
this[2] = v;
this.onChange();
}
set(x, y = x, z = x) {
if (x.length) return this.copy(x);
this[0] = x;
this[1] = y;
this[2] = z;
this.onChange();
return this;
}
copy(v) {
this[0] = v[0];
this[1] = v[1];
this[2] = v[2];
this.onChange();
return this;
}
reorder(order) {
this.order = order;
this.onChange();
return this;
}
fromRotationMatrix(m, order = this.order) {
EulerFunc.fromRotationMatrix(this, m, order);
return this;
}
fromQuaternion(q, order = this.order) {
tmpMat4.fromQuaternion(q);
return this.fromRotationMatrix(tmpMat4, order);
}
toArray(a = [], o = 0) {
a[o] = this[0];
a[o + 1] = this[1];
a[o + 2] = this[2];
return a;
}
}