Blocks.prototype.merge = function()

in src/lib/vpsc.js [287:305]


    Blocks.prototype.merge = function (c) {
        var l = c.left.block, r = c.right.block;
        /* DEBUG
                    console.assert(l!==r, "attempt to merge within the same block");
        DEBUG */
        var dist = c.right.offset - c.left.offset - c.gap;
        if (l.vars.length < r.vars.length) {
            r.mergeAcross(l, c, dist);
            this.remove(l);
        }
        else {
            l.mergeAcross(r, c, -dist);
            this.remove(r);
        }
        /* DEBUG
                    console.assert(Math.abs(c.slack()) < 1e-6, "Error: Constraint should be at equality after merge!");
                    console.log("merged on " + c);
        DEBUG */
    };