"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function computeMatrix(layoutSpec, currentMatrix, currentsizeAbsolute, parentsizeAbsolute) {
    var alignY = layoutSpec.align.y * parentsizeAbsolute.y;
    var alignX = layoutSpec.align.x * parentsizeAbsolute.x;
    var alignZ = layoutSpec.align.z * parentsizeAbsolute.z;
    var mountPointX = layoutSpec.mount.x * currentsizeAbsolute.x;
    var mountPointY = layoutSpec.mount.y * currentsizeAbsolute.y;
    var mountPointZ = layoutSpec.mount.z * currentsizeAbsolute.z;
    var originX = layoutSpec.origin.x * currentsizeAbsolute.x;
    var originY = layoutSpec.origin.y * currentsizeAbsolute.y;
    var originZ = layoutSpec.origin.z * currentsizeAbsolute.z;
    var wx = layoutSpec.orientation.w * layoutSpec.orientation.x;
    var wy = layoutSpec.orientation.w * layoutSpec.orientation.y;
    var wz = layoutSpec.orientation.w * layoutSpec.orientation.z;
    var xx = layoutSpec.orientation.x * layoutSpec.orientation.x;
    var yy = layoutSpec.orientation.y * layoutSpec.orientation.y;
    var zz = layoutSpec.orientation.z * layoutSpec.orientation.z;
    var xy = layoutSpec.orientation.x * layoutSpec.orientation.y;
    var xz = layoutSpec.orientation.x * layoutSpec.orientation.z;
    var yz = layoutSpec.orientation.y * layoutSpec.orientation.z;
    var rs0 = (1 - 2 * (yy + zz)) * layoutSpec.scale.x;
    var rs1 = 2 * (xy + wz) * layoutSpec.scale.x;
    var rs2 = 2 * (xz - wy) * layoutSpec.scale.x;
    var rs3 = 2 * (xy - wz) * layoutSpec.scale.y;
    var rs4 = (1 - 2 * (xx + zz)) * layoutSpec.scale.y;
    var rs5 = 2 * (yz + wx) * layoutSpec.scale.y;
    var rs6 = 2 * (xz + wy) * layoutSpec.scale.z;
    var rs7 = 2 * (yz - wx) * layoutSpec.scale.z;
    var rs8 = (1 - 2 * (xx + yy)) * layoutSpec.scale.z;
    var tx = alignX +
        layoutSpec.translation.x -
        mountPointX +
        originX -
        (rs0 * originX + rs3 * originY + rs6 * originZ);
    var ty = alignY +
        layoutSpec.translation.y -
        mountPointY +
        originY -
        (rs1 * originX + rs4 * originY + rs7 * originZ);
    var tz = alignZ +
        layoutSpec.translation.z -
        mountPointZ +
        originZ -
        (rs2 * originX + rs5 * originY + rs8 * originZ);
    return [rs0, rs1, rs2, 0, rs3, rs4, rs5, 0, rs6, rs7, rs8, 0, tx, ty, tz, 1];
}
exports.default = computeMatrix;
//# sourceMappingURL=computeMatrix.js.map