MCPcopy Create free account
hub / github.com/melonjs/melonJS / multiply

Method multiply

packages/melonjs/src/math/matrix3d.ts:162–252  ·  view source on GitHub ↗

* multiply both matrix * @param m - Other matrix (Matrix3d or Matrix2d) * @returns Reference to this object for method chaining

(m: Matrix3d | Matrix2d)

Source from the content-addressed store, hash-verified

160 * @returns Reference to this object for method chaining
161 */
162 multiply(m: Matrix3d | Matrix2d) {
163 const a = this.val;
164 const b = m.val;
165
166 // if the input is a Matrix2d (9 elements), promote to 4x4 layout inline
167 // Matrix2d: [a,b,0, c,d,0, tx,ty,1] → 4x4: [a,b,0,0, c,d,0,0, 0,0,1,0, tx,ty,0,1]
168 let b00: number, b01: number, b02: number, b03: number;
169 let b10: number, b11: number, b12: number, b13: number;
170 let b20: number, b21: number, b22: number, b23: number;
171 let b30: number, b31: number, b32: number, b33: number;
172
173 if (b.length === 9) {
174 b00 = b[0];
175 b01 = b[1];
176 b02 = 0;
177 b03 = 0;
178 b10 = b[3];
179 b11 = b[4];
180 b12 = 0;
181 b13 = 0;
182 b20 = 0;
183 b21 = 0;
184 b22 = 1;
185 b23 = 0;
186 b30 = b[6];
187 b31 = b[7];
188 b32 = 0;
189 b33 = 1;
190 } else {
191 b00 = b[0];
192 b01 = b[1];
193 b02 = b[2];
194 b03 = b[3];
195 b10 = b[4];
196 b11 = b[5];
197 b12 = b[6];
198 b13 = b[7];
199 b20 = b[8];
200 b21 = b[9];
201 b22 = b[10];
202 b23 = b[11];
203 b30 = b[12];
204 b31 = b[13];
205 b32 = b[14];
206 b33 = b[15];
207 }
208
209 const a00 = a[0];
210 const a01 = a[1];
211 const a02 = a[2];
212 const a03 = a[3];
213 const a10 = a[4];
214 const a11 = a[5];
215 const a12 = a[6];
216 const a13 = a[7];
217 const a20 = a[8];
218 const a21 = a[9];
219 const a22 = a[10];

Callers 9

worldToScreenMethod · 0.45
_rebuildFrustumPlanesMethod · 0.45
drawMethod · 0.45
transformMethod · 0.45
_projectVerticesMethod · 0.45
mat3d.spec.tsFile · 0.45
mesh.spec.jsFile · 0.45
mat2d.spec.tsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected