lib/smiths/packing.smith.js
function () {
    // Grab the items
    var items = this.items;

    // Find the most negative x and y
    var minX = Infinity,
        minY = Infinity;
    items.forEach(function (item) {
      var coords = item;
      minX = Math.min(minX, coords.x);
      minY = Math.min(minY, coords.y);
    });

    // Offset each item by -minX, -minY; effectively resetting to 0, 0
    items.forEach(function (item) {
      var coords = item;
      coords.x -= minX;
      coords.y -= minY;
    });
  }
function () {
    // Grab the items
    var items = this.items;

    // Find the most negative x and y
    var minX = Infinity,
        minY = Infinity;
    items.forEach(function (item) {
      var coords = item;
      minX = Math.min(minX, coords.x);
      minY = Math.min(minY, coords.y);
    });

    // Offset each item by -minX, -minY; effectively resetting to 0, 0
    items.forEach(function (item) {
      var coords = item;
      coords.x -= minX;
      coords.y -= minY;
    });
  }
function ( ) { // Grab the items var items = this . items ; // Find the most negative x and y var minX = Infinity , minY = Infinity ; items . forEach ( function ( item ) { var coords = item ; minX = Math . min ( minX , coords . x ) ; minY = Math . min ( minY , coords . y ) ; } ) ; // Offset each item by -minX, -minY; effectively resetting to 0, 0 items . forEach ( function ( item ) { var coords = item ; coords . x -= minX ; coords . y -= minY ; } ) ; }
Method to normalize coordinates to 0, 0 This is bad to do mid-addition since it messes up the algorithm
Method to normalize coordinates to 0 0 This is bad to do mid - addition since it messes up the algorithm