(Sorry, can't find any way of entering a feature request)
Sometimes its useful to transform vectors using a matrix on the Javascript side. A feature to multiply a vector by a matrix would make this easier; I can't see any simple way of doing this with the provided functions.
Suggested code:
function M4x4_transform(m, v, r) { if (r == undefined) { r = new MJS_FLOAT_ARRAY_TYPE(3); }
var w = 1; r[0] = v[0] * m[0] + v[1] * m[4] + v[2] * m[8] + w * m[12]; r[1] = v[0] * m[1] + v[1] * m[5] + v[2] * m[9] + w * m[13]; r[2] = v[0] * m[2] + v[1] * m[6] + v[2] * m[10] + w * m[14];
return r } M4x4.transform = M4x4_transform;
Comment #1
Posted on Dec 15, 2010 by Swift HippoThis issue was closed by revision da3f58351b.
Status: Fixed
Labels:
Type-Defect
Priority-Medium