diff --git a/packages/vectors/src/mat23.ts b/packages/vectors/src/mat23.ts index 650c21858e..81083b62ea 100644 --- a/packages/vectors/src/mat23.ts +++ b/packages/vectors/src/mat23.ts @@ -294,9 +294,8 @@ export class Mat23 implements } toString() { - const i = this.i; - const b = [...this.buf.slice(i, i + 6)].map((x) => x.toFixed(4)); - return `${b[i]} ${b[i + 2]} ${b[i + 4]}\n${b[i + 1]} ${b[i + 3]} ${b[i + 5]}`; + const b = (get23(this.buf, this.i)).map((x) => x.toFixed(4)); + return `${b[0]} ${b[2]} ${b[4]}\n${b[1]} ${b[3]} ${b[5]}`; } toJSON() { diff --git a/packages/vectors/src/mat33.ts b/packages/vectors/src/mat33.ts index cc427277c9..08bef70f75 100644 --- a/packages/vectors/src/mat33.ts +++ b/packages/vectors/src/mat33.ts @@ -338,11 +338,10 @@ export class Mat33 implements } toString() { - const i = this.i; - const b = [...this.buf.slice(i, i + 9)].map((x) => x.toFixed(4)); - return `${b[i]} ${b[i + 3]} ${b[i + 6]} -${b[i + 1]} ${b[i + 4]} ${b[i + 7]} -${b[i + 2]} ${b[i + 5]} ${b[i + 8]}`; + const b = (get33(this.buf, this.i)).map((x) => x.toFixed(4)); + return `${b[0]} ${b[3]} ${b[6]} +${b[1]} ${b[4]} ${b[7]} +${b[2]} ${b[5]} ${b[8]}`; } toJSON() { diff --git a/packages/vectors/src/mat44.ts b/packages/vectors/src/mat44.ts index e670946c97..8e2889f5be 100644 --- a/packages/vectors/src/mat44.ts +++ b/packages/vectors/src/mat44.ts @@ -575,12 +575,11 @@ export class Mat44 implements } toString() { - const i = this.i; - const b = [...this.buf.slice(i, i + 16)].map((x) => x.toFixed(4)); - return `${b[i]} ${b[i + 4]} ${b[i + 8]} ${b[i + 12]} -${b[i + 1]} ${b[i + 5]} ${b[i + 9]} ${b[i + 13]} -${b[i + 2]} ${b[i + 6]} ${b[i + 10]} ${b[i + 14]} -${b[i + 3]} ${b[i + 7]} ${b[i + 11]} ${b[i + 15]}`; + const b = (get44(this.buf, this.i)).map((x) => x.toFixed(4)); + return `${b[0]} ${b[4]} ${b[8]} ${b[12]} +${b[1]} ${b[5]} ${b[9]} ${b[13]} +${b[2]} ${b[6]} ${b[10]} ${b[14]} +${b[3]} ${b[7]} ${b[11]} ${b[15]}`; } toJSON() {