Best JavaScript code snippet using wpt
M4.js
Source:M4.js
1Clazz.declarePackage ("JU");2Clazz.load (["JU.M34"], "JU.M4", ["JU.T3"], function () {3c$ = Clazz.decorateAsClass (function () {4this.m03 = 0;5this.m13 = 0;6this.m23 = 0;7this.m30 = 0;8this.m31 = 0;9this.m32 = 0;10this.m33 = 0;11Clazz.instantialize (this, arguments);12}, JU, "M4", JU.M34);13c$.newA16 = Clazz.defineMethod (c$, "newA16", 14function (v) {15var m = new JU.M4 ();16m.m00 = v[0];17m.m01 = v[1];18m.m02 = v[2];19m.m03 = v[3];20m.m10 = v[4];21m.m11 = v[5];22m.m12 = v[6];23m.m13 = v[7];24m.m20 = v[8];25m.m21 = v[9];26m.m22 = v[10];27m.m23 = v[11];28m.m30 = v[12];29m.m31 = v[13];30m.m32 = v[14];31m.m33 = v[15];32return m;33}, "~A");34c$.newM4 = Clazz.defineMethod (c$, "newM4", 35function (m1) {36var m = new JU.M4 ();37if (m1 == null) {38m.setIdentity ();39return m;40}m.setToM3 (m1);41m.m03 = m1.m03;42m.m13 = m1.m13;43m.m23 = m1.m23;44m.m30 = m1.m30;45m.m31 = m1.m31;46m.m32 = m1.m32;47m.m33 = m1.m33;48return m;49}, "JU.M4");50c$.newMV = Clazz.defineMethod (c$, "newMV", 51function (m1, t) {52var m = new JU.M4 ();53m.setMV (m1, t);54return m;55}, "JU.M3,JU.T3");56Clazz.defineMethod (c$, "setZero", 57function () {58this.clear33 ();59this.m03 = this.m13 = this.m23 = this.m30 = this.m31 = this.m32 = this.m33 = 0.0;60});61Clazz.defineMethod (c$, "setIdentity", 62function () {63this.setZero ();64this.m00 = this.m11 = this.m22 = this.m33 = 1.0;65});66Clazz.defineMethod (c$, "setM4", 67function (m1) {68this.setM33 (m1);69this.m03 = m1.m03;70this.m13 = m1.m13;71this.m23 = m1.m23;72this.m30 = m1.m30;73this.m31 = m1.m31;74this.m32 = m1.m32;75this.m33 = m1.m33;76return this;77}, "JU.M4");78Clazz.defineMethod (c$, "setMV", 79function (m1, t) {80this.setM33 (m1);81this.setTranslation (t);82this.m33 = 1;83}, "JU.M3,JU.T3");84Clazz.defineMethod (c$, "setToM3", 85function (m1) {86this.setM33 (m1);87this.m03 = this.m13 = this.m23 = this.m30 = this.m31 = this.m32 = 0.0;88this.m33 = 1.0;89}, "JU.M34");90Clazz.defineMethod (c$, "setToAA", 91function (a) {92this.setIdentity ();93this.setAA33 (a);94}, "JU.A4");95Clazz.defineMethod (c$, "setA", 96function (m) {97this.m00 = m[0];98this.m01 = m[1];99this.m02 = m[2];100this.m03 = m[3];101this.m10 = m[4];102this.m11 = m[5];103this.m12 = m[6];104this.m13 = m[7];105this.m20 = m[8];106this.m21 = m[9];107this.m22 = m[10];108this.m23 = m[11];109this.m30 = m[12];110this.m31 = m[13];111this.m32 = m[14];112this.m33 = m[15];113}, "~A");114Clazz.defineMethod (c$, "setTranslation", 115function (trans) {116this.m03 = trans.x;117this.m13 = trans.y;118this.m23 = trans.z;119}, "JU.T3");120Clazz.defineMethod (c$, "setElement", 121function (row, col, v) {122if (row < 3 && col < 3) {123this.set33 (row, col, v);124return;125}if (row > 3 || col > 3) this.err ();126switch (row) {127case 0:128this.m03 = v;129return;130case 1:131this.m13 = v;132return;133case 2:134this.m23 = v;135return;136}137switch (col) {138case 0:139this.m30 = v;140return;141case 1:142this.m31 = v;143return;144case 2:145this.m32 = v;146return;147case 3:148this.m33 = v;149return;150}151}, "~N,~N,~N");152Clazz.defineMethod (c$, "getElement", 153function (row, col) {154if (row < 3 && col < 3) return this.get33 (row, col);155if (row > 3 || col > 3) {156this.err ();157return 0;158}switch (row) {159case 0:160return this.m03;161case 1:162return this.m13;163case 2:164return this.m23;165default:166switch (col) {167case 0:168return this.m30;169case 1:170return this.m31;171case 2:172return this.m32;173default:174return this.m33;175}176}177}, "~N,~N");178Clazz.defineMethod (c$, "getTranslation", 179function (trans) {180trans.x = this.m03;181trans.y = this.m13;182trans.z = this.m23;183}, "JU.T3");184Clazz.defineMethod (c$, "getRotationScale", 185function (m1) {186m1.m00 = this.m00;187m1.m01 = this.m01;188m1.m02 = this.m02;189m1.m10 = this.m10;190m1.m11 = this.m11;191m1.m12 = this.m12;192m1.m20 = this.m20;193m1.m21 = this.m21;194m1.m22 = this.m22;195}, "JU.M3");196Clazz.defineMethod (c$, "setRotationScale", 197function (m1) {198this.m00 = m1.m00;199this.m01 = m1.m01;200this.m02 = m1.m02;201this.m10 = m1.m10;202this.m11 = m1.m11;203this.m12 = m1.m12;204this.m20 = m1.m20;205this.m21 = m1.m21;206this.m22 = m1.m22;207}, "JU.M3");208Clazz.defineMethod (c$, "setRowA", 209function (row, v) {210if (row < 3) this.setRow33 (row, v);211switch (row) {212case 0:213this.m03 = v[3];214return;215case 1:216this.m13 = v[3];217return;218case 2:219this.m23 = v[3];220return;221case 3:222this.m30 = v[0];223this.m31 = v[1];224this.m32 = v[2];225this.m33 = v[3];226return;227}228this.err ();229}, "~N,~A");230Clazz.overrideMethod (c$, "getRow", 231function (row, v) {232if (row < 3) this.getRow33 (row, v);233switch (row) {234case 0:235v[3] = this.m03;236return;237case 1:238v[3] = this.m13;239return;240case 2:241v[3] = this.m23;242return;243case 3:244v[0] = this.m30;245v[1] = this.m31;246v[2] = this.m32;247v[3] = this.m33;248return;249}250this.err ();251}, "~N,~A");252Clazz.defineMethod (c$, "setColumn4", 253function (column, x, y, z, w) {254if (column == 0) {255this.m00 = x;256this.m10 = y;257this.m20 = z;258this.m30 = w;259} else if (column == 1) {260this.m01 = x;261this.m11 = y;262this.m21 = z;263this.m31 = w;264} else if (column == 2) {265this.m02 = x;266this.m12 = y;267this.m22 = z;268this.m32 = w;269} else if (column == 3) {270this.m03 = x;271this.m13 = y;272this.m23 = z;273this.m33 = w;274} else {275this.err ();276}}, "~N,~N,~N,~N,~N");277Clazz.defineMethod (c$, "setColumnA", 278function (column, v) {279if (column < 3) this.setColumn33 (column, v);280switch (column) {281case 0:282this.m30 = v[3];283return;284case 1:285this.m31 = v[3];286return;287case 2:288this.m32 = v[3];289return;290case 3:291this.m03 = v[0];292this.m13 = v[1];293this.m23 = v[2];294this.m33 = v[3];295return;296default:297this.err ();298}299}, "~N,~A");300Clazz.defineMethod (c$, "getColumn", 301function (column, v) {302if (column < 3) this.getColumn33 (column, v);303switch (column) {304case 0:305v[3] = this.m30;306return;307case 1:308v[3] = this.m31;309return;310case 2:311v[3] = this.m32;312return;313case 3:314v[0] = this.m03;315v[1] = this.m13;316v[2] = this.m23;317v[3] = this.m33;318return;319default:320this.err ();321}322}, "~N,~A");323Clazz.defineMethod (c$, "sub", 324function (m1) {325this.sub33 (m1);326this.m03 -= m1.m03;327this.m13 -= m1.m13;328this.m23 -= m1.m23;329this.m30 -= m1.m30;330this.m31 -= m1.m31;331this.m32 -= m1.m32;332this.m33 -= m1.m33;333}, "JU.M4");334Clazz.defineMethod (c$, "transpose", 335function () {336this.transpose33 ();337var tmp = this.m03;338this.m03 = this.m30;339this.m30 = tmp;340tmp = this.m13;341this.m13 = this.m31;342this.m31 = tmp;343tmp = this.m23;344this.m23 = this.m32;345this.m32 = tmp;346});347Clazz.defineMethod (c$, "invert", 348function () {349var s = this.determinant4 ();350if (s == 0.0) return this;351s = 1 / s;352this.set (this.m11 * (this.m22 * this.m33 - this.m23 * this.m32) + this.m12 * (this.m23 * this.m31 - this.m21 * this.m33) + this.m13 * (this.m21 * this.m32 - this.m22 * this.m31), this.m21 * (this.m02 * this.m33 - this.m03 * this.m32) + this.m22 * (this.m03 * this.m31 - this.m01 * this.m33) + this.m23 * (this.m01 * this.m32 - this.m02 * this.m31), this.m31 * (this.m02 * this.m13 - this.m03 * this.m12) + this.m32 * (this.m03 * this.m11 - this.m01 * this.m13) + this.m33 * (this.m01 * this.m12 - this.m02 * this.m11), this.m01 * (this.m13 * this.m22 - this.m12 * this.m23) + this.m02 * (this.m11 * this.m23 - this.m13 * this.m21) + this.m03 * (this.m12 * this.m21 - this.m11 * this.m22), this.m12 * (this.m20 * this.m33 - this.m23 * this.m30) + this.m13 * (this.m22 * this.m30 - this.m20 * this.m32) + this.m10 * (this.m23 * this.m32 - this.m22 * this.m33), this.m22 * (this.m00 * this.m33 - this.m03 * this.m30) + this.m23 * (this.m02 * this.m30 - this.m00 * this.m32) + this.m20 * (this.m03 * this.m32 - this.m02 * this.m33), this.m32 * (this.m00 * this.m13 - this.m03 * this.m10) + this.m33 * (this.m02 * this.m10 - this.m00 * this.m12) + this.m30 * (this.m03 * this.m12 - this.m02 * this.m13), this.m02 * (this.m13 * this.m20 - this.m10 * this.m23) + this.m03 * (this.m10 * this.m22 - this.m12 * this.m20) + this.m00 * (this.m12 * this.m23 - this.m13 * this.m22), this.m13 * (this.m20 * this.m31 - this.m21 * this.m30) + this.m10 * (this.m21 * this.m33 - this.m23 * this.m31) + this.m11 * (this.m23 * this.m30 - this.m20 * this.m33), this.m23 * (this.m00 * this.m31 - this.m01 * this.m30) + this.m20 * (this.m01 * this.m33 - this.m03 * this.m31) + this.m21 * (this.m03 * this.m30 - this.m00 * this.m33), this.m33 * (this.m00 * this.m11 - this.m01 * this.m10) + this.m30 * (this.m01 * this.m13 - this.m03 * this.m11) + this.m31 * (this.m03 * this.m10 - this.m00 * this.m13), this.m03 * (this.m11 * this.m20 - this.m10 * this.m21) + this.m00 * (this.m13 * this.m21 - this.m11 * this.m23) + this.m01 * (this.m10 * this.m23 - this.m13 * this.m20), this.m10 * (this.m22 * this.m31 - this.m21 * this.m32) + this.m11 * (this.m20 * this.m32 - this.m22 * this.m30) + this.m12 * (this.m21 * this.m30 - this.m20 * this.m31), this.m20 * (this.m02 * this.m31 - this.m01 * this.m32) + this.m21 * (this.m00 * this.m32 - this.m02 * this.m30) + this.m22 * (this.m01 * this.m30 - this.m00 * this.m31), this.m30 * (this.m02 * this.m11 - this.m01 * this.m12) + this.m31 * (this.m00 * this.m12 - this.m02 * this.m10) + this.m32 * (this.m01 * this.m10 - this.m00 * this.m11), this.m00 * (this.m11 * this.m22 - this.m12 * this.m21) + this.m01 * (this.m12 * this.m20 - this.m10 * this.m22) + this.m02 * (this.m10 * this.m21 - this.m11 * this.m20));353this.scale (s);354return this;355});356Clazz.defineMethod (c$, "set", 357 function (m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {358this.m00 = m00;359this.m01 = m01;360this.m02 = m02;361this.m03 = m03;362this.m10 = m10;363this.m11 = m11;364this.m12 = m12;365this.m13 = m13;366this.m20 = m20;367this.m21 = m21;368this.m22 = m22;369this.m23 = m23;370this.m30 = m30;371this.m31 = m31;372this.m32 = m32;373this.m33 = m33;374}, "~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N,~N");375Clazz.defineMethod (c$, "determinant4", 376function () {377return (this.m00 * this.m11 - this.m01 * this.m10) * (this.m22 * this.m33 - this.m23 * this.m32) - (this.m00 * this.m12 - this.m02 * this.m10) * (this.m21 * this.m33 - this.m23 * this.m31) + (this.m00 * this.m13 - this.m03 * this.m10) * (this.m21 * this.m32 - this.m22 * this.m31) + (this.m01 * this.m12 - this.m02 * this.m11) * (this.m20 * this.m33 - this.m23 * this.m30) - (this.m01 * this.m13 - this.m03 * this.m11) * (this.m20 * this.m32 - this.m22 * this.m30) + (this.m02 * this.m13 - this.m03 * this.m12) * (this.m20 * this.m31 - this.m21 * this.m30);378});379Clazz.defineMethod (c$, "scale", 380function (scalar) {381this.mul33 (scalar);382this.m03 *= scalar;383this.m13 *= scalar;384this.m23 *= scalar;385this.m30 *= scalar;386this.m31 *= scalar;387this.m32 *= scalar;388this.m33 *= scalar;389}, "~N");390Clazz.defineMethod (c$, "mul", 391function (m1) {392this.mul2 (this, m1);393}, "JU.M4");394Clazz.defineMethod (c$, "mul2", 395function (m1, m2) {396this.set (m1.m00 * m2.m00 + m1.m01 * m2.m10 + m1.m02 * m2.m20 + m1.m03 * m2.m30, m1.m00 * m2.m01 + m1.m01 * m2.m11 + m1.m02 * m2.m21 + m1.m03 * m2.m31, m1.m00 * m2.m02 + m1.m01 * m2.m12 + m1.m02 * m2.m22 + m1.m03 * m2.m32, m1.m00 * m2.m03 + m1.m01 * m2.m13 + m1.m02 * m2.m23 + m1.m03 * m2.m33, m1.m10 * m2.m00 + m1.m11 * m2.m10 + m1.m12 * m2.m20 + m1.m13 * m2.m30, m1.m10 * m2.m01 + m1.m11 * m2.m11 + m1.m12 * m2.m21 + m1.m13 * m2.m31, m1.m10 * m2.m02 + m1.m11 * m2.m12 + m1.m12 * m2.m22 + m1.m13 * m2.m32, m1.m10 * m2.m03 + m1.m11 * m2.m13 + m1.m12 * m2.m23 + m1.m13 * m2.m33, m1.m20 * m2.m00 + m1.m21 * m2.m10 + m1.m22 * m2.m20 + m1.m23 * m2.m30, m1.m20 * m2.m01 + m1.m21 * m2.m11 + m1.m22 * m2.m21 + m1.m23 * m2.m31, m1.m20 * m2.m02 + m1.m21 * m2.m12 + m1.m22 * m2.m22 + m1.m23 * m2.m32, m1.m20 * m2.m03 + m1.m21 * m2.m13 + m1.m22 * m2.m23 + m1.m23 * m2.m33, m1.m30 * m2.m00 + m1.m31 * m2.m10 + m1.m32 * m2.m20 + m1.m33 * m2.m30, m1.m30 * m2.m01 + m1.m31 * m2.m11 + m1.m32 * m2.m21 + m1.m33 * m2.m31, m1.m30 * m2.m02 + m1.m31 * m2.m12 + m1.m32 * m2.m22 + m1.m33 * m2.m32, m1.m30 * m2.m03 + m1.m31 * m2.m13 + m1.m32 * m2.m23 + m1.m33 * m2.m33);397}, "JU.M4,JU.M4");398Clazz.defineMethod (c$, "transform", 399function (vec) {400this.transform2 (vec, vec);401}, "JU.T4");402Clazz.defineMethod (c$, "transform2", 403function (vec, vecOut) {404vecOut.set4 (this.m00 * vec.x + this.m01 * vec.y + this.m02 * vec.z + this.m03 * vec.w, this.m10 * vec.x + this.m11 * vec.y + this.m12 * vec.z + this.m13 * vec.w, this.m20 * vec.x + this.m21 * vec.y + this.m22 * vec.z + this.m23 * vec.w, this.m30 * vec.x + this.m31 * vec.y + this.m32 * vec.z + this.m33 * vec.w);405}, "JU.T4,JU.T4");406Clazz.defineMethod (c$, "rotTrans", 407function (point) {408this.rotTrans2 (point, point);409}, "JU.T3");410Clazz.defineMethod (c$, "rotTrans2", 411function (point, pointOut) {412pointOut.set (this.m00 * point.x + this.m01 * point.y + this.m02 * point.z + this.m03, this.m10 * point.x + this.m11 * point.y + this.m12 * point.z + this.m13, this.m20 * point.x + this.m21 * point.y + this.m22 * point.z + this.m23);413return pointOut;414}, "JU.T3,JU.T3");415Clazz.defineMethod (c$, "setAsXYRotation", 416function (angle) {417this.setIdentity ();418var c = Math.cos (angle);419var s = Math.sin (angle);420this.m22 = c;421this.m23 = -s;422this.m32 = s;423this.m33 = c;424return this;425}, "~N");426Clazz.defineMethod (c$, "setAsYZRotation", 427function (angle) {428this.setIdentity ();429var c = Math.cos (angle);430var s = Math.sin (angle);431this.m00 = c;432this.m03 = -s;433this.m30 = s;434this.m33 = c;435return this;436}, "~N");437Clazz.defineMethod (c$, "setAsXZRotation", 438function (angle) {439this.setIdentity ();440var c = Math.cos (angle);441var s = Math.sin (angle);442this.m11 = c;443this.m13 = -s;444this.m31 = s;445this.m33 = c;446return this;447}, "~N");448Clazz.overrideMethod (c$, "equals", 449function (o) {450if (!(Clazz.instanceOf (o, JU.M4))) return false;451var m = o;452return (this.m00 == m.m00 && this.m01 == m.m01 && this.m02 == m.m02 && this.m03 == m.m03 && this.m10 == m.m10 && this.m11 == m.m11 && this.m12 == m.m12 && this.m13 == m.m13 && this.m20 == m.m20 && this.m21 == m.m21 && this.m22 == m.m22 && this.m23 == m.m23 && this.m30 == m.m30 && this.m31 == m.m31 && this.m32 == m.m32 && this.m33 == m.m33);453}, "~O");454Clazz.overrideMethod (c$, "hashCode", 455function () {456return JU.T3.floatToIntBits (this.m00) ^ JU.T3.floatToIntBits (this.m01) ^ JU.T3.floatToIntBits (this.m02) ^ JU.T3.floatToIntBits (this.m03) ^ JU.T3.floatToIntBits (this.m10) ^ JU.T3.floatToIntBits (this.m11) ^ JU.T3.floatToIntBits (this.m12) ^ JU.T3.floatToIntBits (this.m13) ^ JU.T3.floatToIntBits (this.m20) ^ JU.T3.floatToIntBits (this.m21) ^ JU.T3.floatToIntBits (this.m22) ^ JU.T3.floatToIntBits (this.m23) ^ JU.T3.floatToIntBits (this.m30) ^ JU.T3.floatToIntBits (this.m31) ^ JU.T3.floatToIntBits (this.m32) ^ JU.T3.floatToIntBits (this.m33);457});458Clazz.overrideMethod (c$, "toString", 459function () {460return "[\n [" + this.m00 + "\t" + this.m01 + "\t" + this.m02 + "\t" + this.m03 + "]" + "\n [" + this.m10 + "\t" + this.m11 + "\t" + this.m12 + "\t" + this.m13 + "]" + "\n [" + this.m20 + "\t" + this.m21 + "\t" + this.m22 + "\t" + this.m23 + "]" + "\n [" + this.m30 + "\t" + this.m31 + "\t" + this.m32 + "\t" + this.m33 + "] ]";461});462Clazz.defineMethod (c$, "round", 463function (f) {464this.m00 = this.rnd (this.m00, f);465this.m01 = this.rnd (this.m01, f);466this.m02 = this.rnd (this.m02, f);467this.m03 = this.rnd (this.m03, f);468this.m10 = this.rnd (this.m10, f);469this.m11 = this.rnd (this.m11, f);470this.m12 = this.rnd (this.m12, f);471this.m13 = this.rnd (this.m13, f);472this.m20 = this.rnd (this.m20, f);473this.m21 = this.rnd (this.m21, f);474this.m22 = this.rnd (this.m22, f);475this.m23 = this.rnd (this.m23, f);476this.m30 = this.rnd (this.m30, f);477this.m31 = this.rnd (this.m31, f);478this.m32 = this.rnd (this.m32, f);479this.m33 = this.rnd (this.m33, f);480return this;481}, "~N");482Clazz.defineMethod (c$, "rnd", 483 function (n, f) {484return (Math.abs (n) < f ? 0 : n);485}, "~N,~N");...
Matrix4.ts
Source:Matrix4.ts
1/******************************************************************************2 * Spine Runtimes Software License v2.53 *4 * Copyright (c) 2013-2016, Esoteric Software5 * All rights reserved.6 *7 * You are granted a perpetual, non-exclusive, non-sublicensable, and8 * non-transferable license to use, install, execute, and perform the Spine9 * Runtimes software and derivative works solely for personal or internal10 * use. Without the written permission of Esoteric Software (see Section 2 of11 * the Spine Software License Agreement), you may not (a) modify, translate,12 * adapt, or develop new applications using the Spine Runtimes or otherwise13 * create derivative works or improvements of the Spine Runtimes or (b) remove,14 * delete, alter, or obscure any trademarks or any copyright, trademark, patent,15 * or other intellectual property or proprietary rights notices on or in the16 * Software, including any copy thereof. Redistributions in binary or source17 * form must include this license and terms.18 *19 * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO22 * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF25 * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER26 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE28 * POSSIBILITY OF SUCH DAMAGE.29 *****************************************************************************/3031module spine.webgl {32 export const M00 = 0;33 export const M01 = 4;34 export const M02 = 8;35 export const M03 = 12;36 export const M10 = 1;37 export const M11 = 5;38 export const M12 = 9;39 export const M13 = 13;40 export const M20 = 2;41 export const M21 = 6;42 export const M22 = 10;43 export const M23 = 14;44 export const M30 = 3;45 export const M31 = 7;46 export const M32 = 11;47 export const M33 = 15;4849 export class Matrix4 {50 temp: Float32Array = new Float32Array(16);51 values: Float32Array = new Float32Array(16);5253 private static xAxis: Vector3 = null;54 private static yAxis: Vector3 = null;55 private static zAxis: Vector3 = null;56 private static tmpMatrix = new Matrix4();5758 constructor () {59 let v = this.values;60 v[M00] = 1;61 v[M11] = 1;62 v[M22] = 1;63 v[M33] = 1;64 }6566 set (values: ArrayLike<number>): Matrix4 {67 this.values.set(values);68 return this;69 }7071 transpose (): Matrix4 {72 let t = this.temp;73 let v = this.values;74 t[M00] = v[M00];75 t[M01] = v[M10];76 t[M02] = v[M20];77 t[M03] = v[M30];78 t[M10] = v[M01];79 t[M11] = v[M11];80 t[M12] = v[M21];81 t[M13] = v[M31];82 t[M20] = v[M02];83 t[M21] = v[M12];84 t[M22] = v[M22];85 t[M23] = v[M32];86 t[M30] = v[M03];87 t[M31] = v[M13];88 t[M32] = v[M23];89 t[M33] = v[M33];90 return this.set(t);91 }9293 identity (): Matrix4 {94 let v = this.values;95 v[M00] = 1;96 v[M01] = 0;97 v[M02] = 0;98 v[M03] = 0;99 v[M10] = 0;100 v[M11] = 1;101 v[M12] = 0;102 v[M13] = 0;103 v[M20] = 0;104 v[M21] = 0;105 v[M22] = 1;106 v[M23] = 0;107 v[M30] = 0;108 v[M31] = 0;109 v[M32] = 0;110 v[M33] = 1;111 return this;112 }113114 invert (): Matrix4 {115 let v = this.values;116 let t = this.temp;117 let l_det = v[M30] * v[M21] * v[M12] * v[M03] - v[M20] * v[M31] * v[M12] * v[M03] - v[M30] * v[M11] * v[M22] * v[M03]118 + v[M10] * v[M31] * v[M22] * v[M03] + v[M20] * v[M11] * v[M32] * v[M03] - v[M10] * v[M21] * v[M32] * v[M03]119 - v[M30] * v[M21] * v[M02] * v[M13] + v[M20] * v[M31] * v[M02] * v[M13] + v[M30] * v[M01] * v[M22] * v[M13]120 - v[M00] * v[M31] * v[M22] * v[M13] - v[M20] * v[M01] * v[M32] * v[M13] + v[M00] * v[M21] * v[M32] * v[M13]121 + v[M30] * v[M11] * v[M02] * v[M23] - v[M10] * v[M31] * v[M02] * v[M23] - v[M30] * v[M01] * v[M12] * v[M23]122 + v[M00] * v[M31] * v[M12] * v[M23] + v[M10] * v[M01] * v[M32] * v[M23] - v[M00] * v[M11] * v[M32] * v[M23]123 - v[M20] * v[M11] * v[M02] * v[M33] + v[M10] * v[M21] * v[M02] * v[M33] + v[M20] * v[M01] * v[M12] * v[M33]124 - v[M00] * v[M21] * v[M12] * v[M33] - v[M10] * v[M01] * v[M22] * v[M33] + v[M00] * v[M11] * v[M22] * v[M33];125 if (l_det == 0) throw new Error("non-invertible matrix");126 let inv_det = 1.0 / l_det;127 t[M00] = v[M12] * v[M23] * v[M31] - v[M13] * v[M22] * v[M31] + v[M13] * v[M21] * v[M32]128 - v[M11] * v[M23] * v[M32] - v[M12] * v[M21] * v[M33] + v[M11] * v[M22] * v[M33];129 t[M01] = v[M03] * v[M22] * v[M31] - v[M02] * v[M23] * v[M31] - v[M03] * v[M21] * v[M32]130 + v[M01] * v[M23] * v[M32] + v[M02] * v[M21] * v[M33] - v[M01] * v[M22] * v[M33];131 t[M02] = v[M02] * v[M13] * v[M31] - v[M03] * v[M12] * v[M31] + v[M03] * v[M11] * v[M32]132 - v[M01] * v[M13] * v[M32] - v[M02] * v[M11] * v[M33] + v[M01] * v[M12] * v[M33];133 t[M03] = v[M03] * v[M12] * v[M21] - v[M02] * v[M13] * v[M21] - v[M03] * v[M11] * v[M22]134 + v[M01] * v[M13] * v[M22] + v[M02] * v[M11] * v[M23] - v[M01] * v[M12] * v[M23];135 t[M10] = v[M13] * v[M22] * v[M30] - v[M12] * v[M23] * v[M30] - v[M13] * v[M20] * v[M32]136 + v[M10] * v[M23] * v[M32] + v[M12] * v[M20] * v[M33] - v[M10] * v[M22] * v[M33];137 t[M11] = v[M02] * v[M23] * v[M30] - v[M03] * v[M22] * v[M30] + v[M03] * v[M20] * v[M32]138 - v[M00] * v[M23] * v[M32] - v[M02] * v[M20] * v[M33] + v[M00] * v[M22] * v[M33];139 t[M12] = v[M03] * v[M12] * v[M30] - v[M02] * v[M13] * v[M30] - v[M03] * v[M10] * v[M32]140 + v[M00] * v[M13] * v[M32] + v[M02] * v[M10] * v[M33] - v[M00] * v[M12] * v[M33];141 t[M13] = v[M02] * v[M13] * v[M20] - v[M03] * v[M12] * v[M20] + v[M03] * v[M10] * v[M22]142 - v[M00] * v[M13] * v[M22] - v[M02] * v[M10] * v[M23] + v[M00] * v[M12] * v[M23];143 t[M20] = v[M11] * v[M23] * v[M30] - v[M13] * v[M21] * v[M30] + v[M13] * v[M20] * v[M31]144 - v[M10] * v[M23] * v[M31] - v[M11] * v[M20] * v[M33] + v[M10] * v[M21] * v[M33];145 t[M21] = v[M03] * v[M21] * v[M30] - v[M01] * v[M23] * v[M30] - v[M03] * v[M20] * v[M31]146 + v[M00] * v[M23] * v[M31] + v[M01] * v[M20] * v[M33] - v[M00] * v[M21] * v[M33];147 t[M22] = v[M01] * v[M13] * v[M30] - v[M03] * v[M11] * v[M30] + v[M03] * v[M10] * v[M31]148 - v[M00] * v[M13] * v[M31] - v[M01] * v[M10] * v[M33] + v[M00] * v[M11] * v[M33];149 t[M23] = v[M03] * v[M11] * v[M20] - v[M01] * v[M13] * v[M20] - v[M03] * v[M10] * v[M21]150 + v[M00] * v[M13] * v[M21] + v[M01] * v[M10] * v[M23] - v[M00] * v[M11] * v[M23];151 t[M30] = v[M12] * v[M21] * v[M30] - v[M11] * v[M22] * v[M30] - v[M12] * v[M20] * v[M31]152 + v[M10] * v[M22] * v[M31] + v[M11] * v[M20] * v[M32] - v[M10] * v[M21] * v[M32];153 t[M31] = v[M01] * v[M22] * v[M30] - v[M02] * v[M21] * v[M30] + v[M02] * v[M20] * v[M31]154 - v[M00] * v[M22] * v[M31] - v[M01] * v[M20] * v[M32] + v[M00] * v[M21] * v[M32];155 t[M32] = v[M02] * v[M11] * v[M30] - v[M01] * v[M12] * v[M30] - v[M02] * v[M10] * v[M31] 156 + v[M00] * v[M12] * v[M31] + v[M01] * v[M10] * v[M32] - v[M00] * v[M11] * v[M32];157 t[M33] = v[M01] * v[M12] * v[M20] - v[M02] * v[M11] * v[M20] + v[M02] * v[M10] * v[M21]158 - v[M00] * v[M12] * v[M21] - v[M01] * v[M10] * v[M22] + v[M00] * v[M11] * v[M22];159 v[M00] = t[M00] * inv_det;160 v[M01] = t[M01] * inv_det;161 v[M02] = t[M02] * inv_det;162 v[M03] = t[M03] * inv_det;163 v[M10] = t[M10] * inv_det;164 v[M11] = t[M11] * inv_det;165 v[M12] = t[M12] * inv_det;166 v[M13] = t[M13] * inv_det;167 v[M20] = t[M20] * inv_det;168 v[M21] = t[M21] * inv_det;169 v[M22] = t[M22] * inv_det;170 v[M23] = t[M23] * inv_det;171 v[M30] = t[M30] * inv_det;172 v[M31] = t[M31] * inv_det;173 v[M32] = t[M32] * inv_det;174 v[M33] = t[M33] * inv_det;175 return this;176 }177178 determinant (): number {179 let v = this.values;180 return v[M30] * v[M21] * v[M12] * v[M03] - v[M20] * v[M31] * v[M12] * v[M03] - v[M30] * v[M11] * v[M22] * v[M03]181 + v[M10] * v[M31] * v[M22] * v[M03] + v[M20] * v[M11] * v[M32] * v[M03] - v[M10] * v[M21] * v[M32] * v[M03]182 - v[M30] * v[M21] * v[M02] * v[M13] + v[M20] * v[M31] * v[M02] * v[M13] + v[M30] * v[M01] * v[M22] * v[M13]183 - v[M00] * v[M31] * v[M22] * v[M13] - v[M20] * v[M01] * v[M32] * v[M13] + v[M00] * v[M21] * v[M32] * v[M13]184 + v[M30] * v[M11] * v[M02] * v[M23] - v[M10] * v[M31] * v[M02] * v[M23] - v[M30] * v[M01] * v[M12] * v[M23]185 + v[M00] * v[M31] * v[M12] * v[M23] + v[M10] * v[M01] * v[M32] * v[M23] - v[M00] * v[M11] * v[M32] * v[M23]186 - v[M20] * v[M11] * v[M02] * v[M33] + v[M10] * v[M21] * v[M02] * v[M33] + v[M20] * v[M01] * v[M12] * v[M33]187 - v[M00] * v[M21] * v[M12] * v[M33] - v[M10] * v[M01] * v[M22] * v[M33] + v[M00] * v[M11] * v[M22] * v[M33];188 }189190 translate (x: number, y: number, z: number): Matrix4 {191 let v = this.values;192 v[M03] += x;193 v[M13] += y;194 v[M23] += z;195 return this;196 }197198 copy (): Matrix4 {199 return new Matrix4().set(this.values);200 }201202 projection (near: number, far: number, fovy: number, aspectRatio: number): Matrix4 {203 this.identity();204 let l_fd = (1.0 / Math.tan((fovy * (Math.PI / 180)) / 2.0));205 let l_a1 = (far + near) / (near - far);206 let l_a2 = (2 * far * near) / (near - far);207 let v = this.values;208 v[M00] = l_fd / aspectRatio;209 v[M10] = 0;210 v[M20] = 0;211 v[M30] = 0;212 v[M01] = 0;213 v[M11] = l_fd;214 v[M21] = 0;215 v[M31] = 0;216 v[M02] = 0;217 v[M12] = 0;218 v[M22] = l_a1;219 v[M32] = -1;220 v[M03] = 0;221 v[M13] = 0;222 v[M23] = l_a2;223 v[M33] = 0;224 return this;225 }226227 ortho2d (x: number, y: number, width: number, height: number): Matrix4 {228 return this.ortho(x, x + width, y, y + height, 0, 1);229 }230231 ortho (left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4 {232 this.identity();233 let x_orth = 2 / (right - left);234 let y_orth = 2 / (top - bottom);235 let z_orth = -2 / (far - near);236237 let tx = -(right + left) / (right - left);238 let ty = -(top + bottom) / (top - bottom);239 let tz = -(far + near) / (far - near);240241 let v = this.values;242 v[M00] = x_orth;243 v[M10] = 0;244 v[M20] = 0;245 v[M30] = 0;246 v[M01] = 0;247 v[M11] = y_orth;248 v[M21] = 0;249 v[M31] = 0;250 v[M02] = 0;251 v[M12] = 0;252 v[M22] = z_orth;253 v[M32] = 0;254 v[M03] = tx;255 v[M13] = ty;256 v[M23] = tz;257 v[M33] = 1;258 return this;259 }260261 multiply (matrix: Matrix4): Matrix4 {262 let t = this.temp;263 let v = this.values;264 let m = matrix.values;265 t[M00] = v[M00] * m[M00] + v[M01] * m[M10] + v[M02] * m[M20] + v[M03] * m[M30];266 t[M01] = v[M00] * m[M01] + v[M01] * m[M11] + v[M02] * m[M21] + v[M03] * m[M31];267 t[M02] = v[M00] * m[M02] + v[M01] * m[M12] + v[M02] * m[M22] + v[M03] * m[M32];268 t[M03] = v[M00] * m[M03] + v[M01] * m[M13] + v[M02] * m[M23] + v[M03] * m[M33];269 t[M10] = v[M10] * m[M00] + v[M11] * m[M10] + v[M12] * m[M20] + v[M13] * m[M30];270 t[M11] = v[M10] * m[M01] + v[M11] * m[M11] + v[M12] * m[M21] + v[M13] * m[M31];271 t[M12] = v[M10] * m[M02] + v[M11] * m[M12] + v[M12] * m[M22] + v[M13] * m[M32];272 t[M13] = v[M10] * m[M03] + v[M11] * m[M13] + v[M12] * m[M23] + v[M13] * m[M33];273 t[M20] = v[M20] * m[M00] + v[M21] * m[M10] + v[M22] * m[M20] + v[M23] * m[M30];274 t[M21] = v[M20] * m[M01] + v[M21] * m[M11] + v[M22] * m[M21] + v[M23] * m[M31];275 t[M22] = v[M20] * m[M02] + v[M21] * m[M12] + v[M22] * m[M22] + v[M23] * m[M32];276 t[M23] = v[M20] * m[M03] + v[M21] * m[M13] + v[M22] * m[M23] + v[M23] * m[M33];277 t[M30] = v[M30] * m[M00] + v[M31] * m[M10] + v[M32] * m[M20] + v[M33] * m[M30];278 t[M31] = v[M30] * m[M01] + v[M31] * m[M11] + v[M32] * m[M21] + v[M33] * m[M31];279 t[M32] = v[M30] * m[M02] + v[M31] * m[M12] + v[M32] * m[M22] + v[M33] * m[M32];280 t[M33] = v[M30] * m[M03] + v[M31] * m[M13] + v[M32] * m[M23] + v[M33] * m[M33];281 return this.set(this.temp);282 }283284 multiplyLeft (matrix: Matrix4): Matrix4 {285 let t = this.temp;286 let v = this.values;287 let m = matrix.values;288 t[M00] = m[M00] * v[M00] + m[M01] * v[M10] + m[M02] * v[M20] + m[M03] * v[M30];289 t[M01] = m[M00] * v[M01] + m[M01] * v[M11] + m[M02] * v[M21] + m[M03] * v[M31];290 t[M02] = m[M00] * v[M02] + m[M01] * v[M12] + m[M02] * v[M22] + m[M03] * v[M32];291 t[M03] = m[M00] * v[M03] + m[M01] * v[M13] + m[M02] * v[M23] + m[M03] * v[M33];292 t[M10] = m[M10] * v[M00] + m[M11] * v[M10] + m[M12] * v[M20] + m[M13] * v[M30];293 t[M11] = m[M10] * v[M01] + m[M11] * v[M11] + m[M12] * v[M21] + m[M13] * v[M31];294 t[M12] = m[M10] * v[M02] + m[M11] * v[M12] + m[M12] * v[M22] + m[M13] * v[M32];295 t[M13] = m[M10] * v[M03] + m[M11] * v[M13] + m[M12] * v[M23] + m[M13] * v[M33];296 t[M20] = m[M20] * v[M00] + m[M21] * v[M10] + m[M22] * v[M20] + m[M23] * v[M30];297 t[M21] = m[M20] * v[M01] + m[M21] * v[M11] + m[M22] * v[M21] + m[M23] * v[M31];298 t[M22] = m[M20] * v[M02] + m[M21] * v[M12] + m[M22] * v[M22] + m[M23] * v[M32];299 t[M23] = m[M20] * v[M03] + m[M21] * v[M13] + m[M22] * v[M23] + m[M23] * v[M33];300 t[M30] = m[M30] * v[M00] + m[M31] * v[M10] + m[M32] * v[M20] + m[M33] * v[M30];301 t[M31] = m[M30] * v[M01] + m[M31] * v[M11] + m[M32] * v[M21] + m[M33] * v[M31];302 t[M32] = m[M30] * v[M02] + m[M31] * v[M12] + m[M32] * v[M22] + m[M33] * v[M32];303 t[M33] = m[M30] * v[M03] + m[M31] * v[M13] + m[M32] * v[M23] + m[M33] * v[M33];304 return this.set(this.temp);305 }306307 lookAt (position: Vector3, direction: Vector3, up: Vector3) {308 Matrix4.initTemps();309 let xAxis = Matrix4.xAxis, yAxis = Matrix4.yAxis, zAxis = Matrix4.zAxis;310 zAxis.setFrom(direction).normalize();311 xAxis.setFrom(direction).normalize();312 xAxis.cross(up).normalize();313 yAxis.setFrom(xAxis).cross(zAxis).normalize();314 this.identity();315 let val = this.values;316 val[M00] = xAxis.x;317 val[M01] = xAxis.y;318 val[M02] = xAxis.z;319 val[M10] = yAxis.x;320 val[M11] = yAxis.y;321 val[M12] = yAxis.z;322 val[M20] = -zAxis.x;323 val[M21] = -zAxis.y;324 val[M22] = -zAxis.z;325326 Matrix4.tmpMatrix.identity();327 Matrix4.tmpMatrix.values[M03] = -position.x;328 Matrix4.tmpMatrix.values[M13] = -position.y;329 Matrix4.tmpMatrix.values[M23] = -position.z;330 this.multiply(Matrix4.tmpMatrix)331332 return this;333 }334335 static initTemps() {336 if (Matrix4.xAxis === null) Matrix4.xAxis = new Vector3();337 if (Matrix4.yAxis === null) Matrix4.yAxis = new Vector3();338 if (Matrix4.zAxis === null) Matrix4.zAxis = new Vector3();339 }340 }
...
project2.js
Source:project2.js
1// Returns a 3x3 transformation matrix as an array of 9 values in column-major order.2// The transformation first applies scale, then rotation, and finally translation.3// The given rotation value is in degrees.4function GetTransform( positionX, positionY, rotation, scale )5{ 67 // ç©éµä¹ç顺åºä¸ºï¼ T * R * S8 // T = [1, 0, positionX,9 // 0, 1, positionY,10 // 0, 0, 1]1112 // R = [ cos(rotation), -sin(rotation), 0,13 // sin(rotation), cos(rotation), 0,14 // 0, 0, 1]1516 // S = [scale, 0, 0,17 // 0, scale, 0,18 // 0, 0, 1] å 为è¿éåªæxï¼y两个维度ï¼ææzç缩æ¾ä¸º1ï¼å¦æä¹è®¾ä¸ºscaleåä¼åºç°åå·®1920 // æåç计ç®é¡ºåºä¸å®æ¯21 // T * R * S22 var angle = rotation * Math.PI / 180.023 var m11 = scale * Math.cos(angle);24 var m12 = - scale * Math.sin(angle);25 var m13 = positionX;26 // var m13 = scale * Math.cos(angle) * positionX - scale * Math.sin(angle) * positionY;2728 var m21 = scale * Math.sin(angle);29 var m22 = scale * Math.cos(angle);30 var m23 = positionY;31 // var m23 = scale * Math.sin(angle) * positionX + scale * Math.cos(angle) * positionY;32 33 var m31 = 0;34 var m32 = 0;35 var m33 = 1;3637 // return Array( m11, m12, m13, m21, m22, m23, m31, m32, m33);38 return Array( m11, m21, m31, m12, m22, m32, m13, m23, m33);39 // return Array( 1, 0, 0, 0, 1, 0, 0, 0, 1 );40}4142// Returns a 3x3 transformation matrix as an array of 9 values in column-major order.43// The arguments are transformation matrices in the same format.44// The returned transformation first applies trans1 and then trans2.45function ApplyTransform( trans1, trans2 )46{4748 var m11 = trans1[0];49 var m12 = trans1[3];50 var m13 = trans1[6];5152 var m21 = trans1[1];53 var m22 = trans1[4];54 var m23 = trans1[7];5556 var m31 = trans1[2];57 var m32 = trans1[5];58 var m33 = trans1[8];5960 var _m11 = trans2[0];61 var _m12 = trans2[3];62 var _m13 = trans2[6];6364 var _m21 = trans2[1];65 var _m22 = trans2[4];66 var _m23 = trans2[7];6768 var _m31 = trans2[2];69 var _m32 = trans2[5];70 var _m33 = trans2[8];7172 // var t_m11 = m11 * _m11 + m12 * _m21 + m13 * _m31;73 // var t_m12 = m11 * _m12 + m12 * _m22 + m13 * _m32;74 // var t_m13 = m11 * _m13 + m12 * _m23 + m13 * _m33;7576 // var t_m21 = m21 * _m11 + m22 * _m21 + m23 * _m31;77 // var t_m22 = m21 * _m12 + m22 * _m22 + m23 * _m32;78 // var t_m23 = m21 * _m13 + m22 * _m23 + m23 * _m33;7980 // var t_m31 = m31 * _m11 + m32 * _m21 + m33 * _m31;81 // var t_m32 = m31 * _m12 + m32 * _m22 + m33 * _m32;82 // var t_m33 = m31 * _m13 + m32 * _m23 + m33 * _m33;8384 var t_m11 = _m11 * m11 + _m12 * m21 + _m13 * m31;85 var t_m12 = _m11 * m12 + _m12 * m22 + _m13 * m32;86 var t_m13 = _m11 * m13 + _m12 * m23 + _m13 * m33;8788 var t_m21 = _m21 * m11 + _m22 * m21 + _m23 * m31;89 var t_m22 = _m21 * m12 + _m22 * m22 + _m23 * m32;90 var t_m23 = _m21 * m13 + _m22 * m23 + _m23 * m33;9192 var t_m31 = _m31 * m11 + _m32 * m21 + _m33 * m31;93 var t_m32 = _m31 * m12 + _m32 * m22 + _m33 * m32;94 var t_m33 = _m31 * m13 + _m32 * m23 + _m33 * m33;9596 return Array( t_m11, t_m21, t_m31, t_m12, t_m22, t_m32, t_m13, t_m23, t_m33 );97 // return Array( 1, 0, 0, 0, 1, 0, 0, 0, 1 );
...
Using AI Code Generation
1console.log(wpt.m31());2console.log(wpt.m32());3console.log(wpt.m33());4console.log(wpt.m34());5console.log(wpt.m35());6console.log(wpt.m36());7console.log(wpt.m37());8console.log(wpt.m38());9console.log(wpt.m39());10console.log(wpt.m40());11console.log(wpt.m41());12console.log(wpt.m42());13console.log(wpt.m43());14console.log(wpt.m44());15console.log(wpt.m45());16console.log(wpt.m46());17console.log(wpt.m47());18console.log(wpt.m48());19console.log(wpt.m49());20console.log(wpt.m50());
Using AI Code Generation
1var wpt = require('wpt');2wpt.m31(function(err, data) {3 console.log(data);4});5var wpt = require('wpt');6wpt.m31(function(err, data) {7 console.log(data);8});9var wpt = require('wpt');10wpt.m31(function(err, data) {11 console.log(data);12});13var wpt = require('wpt');14wpt.m31(function(err, data) {15 console.log(data);16});17var wpt = require('wpt');18wpt.m31(function(err, data) {19 console.log(data);20});21var wpt = require('wpt');22wpt.m31(function(err, data) {23 console.log(data);24});25var wpt = require('wpt');26wpt.m31(function(err, data) {27 console.log(data);28});29var wpt = require('wpt');30wpt.m31(function(err, data) {31 console.log(data);32});33var wpt = require('wpt');34wpt.m31(function(err, data) {35 console.log(data);36});37var wpt = require('wpt');38wpt.m31(function(err, data) {39 console.log(data);40});41var wpt = require('wpt');42wpt.m31(function(err, data) {43 console.log(data);44});45var wpt = require('wpt');46wpt.m31(function(err, data) {47 console.log(data);
Using AI Code Generation
1var wpt = require('wpt');2wpt.getLocations(function(err, locations) {3 console.log(locations);4});5var wpt = require('wpt');6wpt.getLocations(function(err, locations) {7 console.log(locations);8});9var wpt = require('wpt');10wpt.getLocations(function(err, locations) {11 console.log(locations);12});13var wpt = require('wpt');14wpt.getLocations(function(err, locations) {15 console.log(locations);16});17var wpt = require('wpt');18wpt.getLocations(function(err, locations) {19 console.log(locations);20});21var wpt = require('wpt');22wpt.getLocations(function(err, locations) {23 console.log(locations);24});25var wpt = require('wpt');26wpt.getLocations(function(err, locations) {27 console.log(locations);28});29var wpt = require('wpt');30wpt.getLocations(function(err, locations) {31 console.log(locations);32});33var wpt = require('wpt');34wpt.getLocations(function(err, locations) {35 console.log(locations);36});37var wpt = require('wpt');38wpt.getLocations(function(err, locations) {39 console.log(locations);40});41var wpt = require('wpt');42wpt.getLocations(function(err, locations) {43 console.log(locations);44});45var wpt = require('wpt');46wpt.getLocations(function(err, locations) {47 console.log(locations);
Using AI Code Generation
1var wpt = require('wpt');2wpt.m31('www.google.com', function(err, data) {3 if(err) {4 console.log('Error: ' + err);5 } else {6 console.log(data);7 }8});9var wpt = require('wpt');10wpt.m32('www.google.com', function(err, data) {11 if(err) {12 console.log('Error: ' + err);13 } else {14 console.log(data);15 }16});17var wpt = require('wpt');18wpt.m33('www.google.com', function(err, data) {19 if(err) {20 console.log('Error: ' + err);21 } else {22 console.log(data);23 }24});25var wpt = require('wpt');26wpt.m34('www.google.com', function(err, data) {27 if(err) {28 console.log('Error: ' + err);29 } else {30 console.log(data);31 }32});33var wpt = require('wpt');34wpt.m35('www.google.com', function(err, data) {35 if(err) {36 console.log('Error: ' + err);37 } else {38 console.log(data);39 }40});
Using AI Code Generation
1var wpt = require('wpt');2 console.log(data);3});4var wpt = require('wpt');5 console.log(data);6});7var wpt = require('wpt');8 console.log(data);9});10var wpt = require('wpt');11 console.log(data);12});13var wpt = require('wpt');14 console.log(data);15});16var wpt = require('wpt');17 console.log(data);18});19var wpt = require('wpt');20 console.log(data);21});22var wpt = require('wpt');23 console.log(data);24});25var wpt = require('wpt');26 console.log(data);27});28var wpt = require('wpt');29 console.log(data);30});
Using AI Code Generation
1var wpt = require('wpt');2var m31 = wpt.m31;3m31('www.google.com', function(err, data) {4 console.log(data);5});6var wpt = require('wpt');7wpt.m31('www.google.com', function(err, data) {8 console.log(data);9});10var wpt = require('wpt');11wpt.m31('www.google.com', function(err, data) {12 console.log(data);13});14var wpt = require('wpt');15wpt.m31('www.google.com', function(err, data) {16 console.log(data);17});18var wpt = require('wpt');19wpt.m31('www.google.com', function(err, data) {20 console.log(data);21});22var wpt = require('wpt');23wpt.m31('www.google.com', function(err, data) {24 console.log(data);25});26var wpt = require('wpt');27wpt.m31('www.google.com', function(err, data) {28 console.log(data);29});30var wpt = require('wpt');31wpt.m31('www.google.com', function(err, data) {32 console.log(data);33});34var wpt = require('wpt');35wpt.m31('www.google.com', function(err, data) {36 console.log(data);37});38var wpt = require('wpt');39wpt.m31('www.google.com', function(err, data) {40 console.log(data);41});42var wpt = require('wpt');
Using AI Code Generation
1var wpt = require('wpt');2wpt.m31('www.webpagetest.org', function(err, data) {3 console.log(data);4});5var wpt = require('wpt');6wpt.m31('www.webpagetest.org', function(err, data) {7 console.log(data);8});
Using AI Code Generation
1var wpt = require('wpt');2wpt.m31(1, 2, 3, function (err, result) {3 console.log(result);4});5var wpt = require('wpt');6wpt.m31(1, 2, 3, function (err, result) {7 console.log(result);8});9var wpt = require('wpt');10wpt.m31(1, 2, 3, function (err, result) {11 console.log(result);12});13var wpt = require('wpt');14wpt.m31(1, 2, 3, function (err, result) {15 console.log(result);16});17var wpt = require('wpt');18wpt.m31(1, 2, 3, function (err, result) {19 console.log(result);20});21var wpt = require('wpt');22wpt.m31(1, 2, 3, function (err, result) {23 console.log(result);24});25var wpt = require('wpt');26wpt.m31(1, 2, 3, function (err, result) {27 console.log(result);28});29var wpt = require('wpt');30wpt.m31(1, 2, 3, function (err, result) {31 console.log(result);32});33var wpt = require('wpt');34wpt.m31(1, 2, 3, function (err, result) {35 console.log(result);36});37var wpt = require('wpt');38wpt.m31(1, 2,
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test submitted to WebPageTest for %s', data.data.testUrl);5 console.log('Test ID: %s', data.data.testId);6 console.log('Test status: %s', data.data.statusText);7});8var wpt = require('webpagetest');9var wpt = new WebPageTest('www.webpagetest.org');10 if (err) return console.error(err);11 console.log('Test submitted to WebPageTest for %s', data.data.testUrl);12 console.log('Test ID: %s', data.data.testId);13 console.log('Test status: %s', data.data.statusText);14});15var WebPageTest = require('webpagetest');16var wpt = new WebPageTest('www.webpagetest.org');17 if (err) return console.error(err);18 console.log('Test submitted to WebPageTest for %s', data.data.testUrl);19 console.log('Test ID: %s', data.data.testId);20 console.log('Test status: %s', data.data.statusText);21});22var wpt = require('webpagetest');23var wpt = new WebPageTest('www.webpagetest.org');24 if (err) return console.error(err);25 console.log('Test submitted to WebPageTest for %s', data.data.testUrl);26 console.log('Test ID: %s', data.data.testId);27 console.log('Test
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!