17 lines
401 B
JavaScript
17 lines
401 B
JavaScript
|
|
module.exports = transformMat2d
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Transforms the vec2 with a mat2d
|
||
|
|
*
|
||
|
|
* @param {vec2} out the receiving vector
|
||
|
|
* @param {vec2} a the vector to transform
|
||
|
|
* @param {mat2d} m matrix to transform with
|
||
|
|
* @returns {vec2} out
|
||
|
|
*/
|
||
|
|
function transformMat2d(out, a, m) {
|
||
|
|
var x = a[0],
|
||
|
|
y = a[1]
|
||
|
|
out[0] = m[0] * x + m[2] * y + m[4]
|
||
|
|
out[1] = m[1] * x + m[3] * y + m[5]
|
||
|
|
return out
|
||
|
|
}
|