MCPcopy Create free account
hub / github.com/microsoft/SandDance / fromRotationTranslationScaleOrigin

Function fromRotationTranslationScaleOrigin

docs/app/js/sanddance-app.js:73687–73734  ·  view source on GitHub ↗
(out, q, v, s, o)

Source from the content-addressed store, hash-verified

73685 return out;
73686}
73687function fromRotationTranslationScaleOrigin(out, q, v, s, o) {
73688 // Quaternion math
73689 var x = q[0], y = q[1], z = q[2], w = q[3];
73690 var x2 = x + x;
73691 var y2 = y + y;
73692 var z2 = z + z;
73693 var xx = x * x2;
73694 var xy = x * y2;
73695 var xz = x * z2;
73696 var yy = y * y2;
73697 var yz = y * z2;
73698 var zz = z * z2;
73699 var wx = w * x2;
73700 var wy = w * y2;
73701 var wz = w * z2;
73702 var sx = s[0];
73703 var sy = s[1];
73704 var sz = s[2];
73705 var ox = o[0];
73706 var oy = o[1];
73707 var oz = o[2];
73708 var out0 = (1 - (yy + zz)) * sx;
73709 var out1 = (xy + wz) * sx;
73710 var out2 = (xz - wy) * sx;
73711 var out4 = (xy - wz) * sy;
73712 var out5 = (1 - (xx + zz)) * sy;
73713 var out6 = (yz + wx) * sy;
73714 var out8 = (xz + wy) * sz;
73715 var out9 = (yz - wx) * sz;
73716 var out10 = (1 - (xx + yy)) * sz;
73717 out[0] = out0;
73718 out[1] = out1;
73719 out[2] = out2;
73720 out[3] = 0;
73721 out[4] = out4;
73722 out[5] = out5;
73723 out[6] = out6;
73724 out[7] = 0;
73725 out[8] = out8;
73726 out[9] = out9;
73727 out[10] = out10;
73728 out[11] = 0;
73729 out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);
73730 out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);
73731 out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);
73732 out[15] = 1;
73733 return out;
73734}
73735function fromQuat(out, q) {
73736 var x = q[0], y = q[1], z = q[2], w = q[3];
73737 var x2 = x + x;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected