diff --git a/package.json b/package.json index 5970507..b602c50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zk3d", - "version": "0.0.9", + "version": "0.12.0", "description": "General-purpose 3D library compatible with o1js and Mina zkApps.", "type": "module", "main": "build/src/index.js", diff --git a/src/Matrix4.ts b/src/Matrix4.ts index 02f7e41..fe21092 100644 --- a/src/Matrix4.ts +++ b/src/Matrix4.ts @@ -514,24 +514,25 @@ export class Matrix4 extends Struct({ ); } - fromArray(array: Real64[]) { - this.n11 = array[0]; - this.n12 = array[1]; - this.n13 = array[2]; - this.n14 = array[3]; - this.n21 = array[4]; - this.n22 = array[5]; - this.n23 = array[6]; - this.n24 = array[7]; - this.n31 = array[8]; - this.n32 = array[9]; - this.n33 = array[10]; - this.n34 = array[11]; - this.n41 = array[12]; - this.n42 = array[13]; - this.n43 = array[14]; - this.n44 = array[15]; - return this; + static fromElements(array: Real64[]) { + return new Matrix4({ + n11: array[0], + n12: array[1], + n13: array[2], + n14: array[3], + n21: array[4], + n22: array[5], + n23: array[6], + n24: array[7], + n31: array[8], + n32: array[9], + n33: array[10], + n34: array[11], + n41: array[12], + n42: array[13], + n43: array[14], + n44: array[15] + }); } toArray() { diff --git a/src/Real64.ts b/src/Real64.ts index 83d736d..56850a2 100644 --- a/src/Real64.ts +++ b/src/Real64.ts @@ -20,7 +20,7 @@ export class Real64 extends Struct({ integer: Int64 }) { } inv() { - return new Real64({ integer: Int64.from(Real64.SCALE).div(this.integer) }); + return new Real64({ integer: Int64.from(Real64.SCALE).mul(Real64.SCALE).div(this.integer) }); } neg() {