src/staging/get-furniture-alternatives.js
function getOffset(a, b) {
  // for elements that are aligned at the wall we want to compute the offset accordingly
  var edgeAligned = config.edgeAligned

  var tags = a.tags
  a = a.boundingPoints
  b = b.boundingPoints
  if (!a || !b) return { x: 0, y: 0, z: 0 }

  // check if the furniture's virtual origin should be center or edge
  var isEdgeAligned = edgeAligned.some(function(t) {
    return tags.includes(t)
  })

  var zOffset
  // compute offset between edges or centers
  if (isEdgeAligned) zOffset = a.min[2] - b.min[2]
  else zOffset = (a.max[2] + a.min[2]) / 2 - (b.max[2] + b.min[2]) / 2

  var offset = {
    // compute offset between centers
    x: (a.max[0] + a.min[0]) / 2 - (b.max[0] + b.min[0]) / 2,
    y: 0,
    z: zOffset
  }
  return offset
}
function getOffset(a, b) {
  // for elements that are aligned at the wall we want to compute the offset accordingly
  var edgeAligned = config.edgeAligned

  var tags = a.tags
  a = a.boundingPoints
  b = b.boundingPoints
  if (!a || !b) return { x: 0, y: 0, z: 0 }

  // check if the furniture's virtual origin should be center or edge
  var isEdgeAligned = edgeAligned.some(function(t) {
    return tags.includes(t)
  })

  var zOffset
  // compute offset between edges or centers
  if (isEdgeAligned) zOffset = a.min[2] - b.min[2]
  else zOffset = (a.max[2] + a.min[2]) / 2 - (b.max[2] + b.min[2]) / 2

  var offset = {
    // compute offset between centers
    x: (a.max[0] + a.min[0]) / 2 - (b.max[0] + b.min[0]) / 2,
    y: 0,
    z: zOffset
  }
  return offset
}
function getOffset ( a , b ) { // for elements that are aligned at the wall we want to compute the offset accordingly var edgeAligned = config . edgeAligned var tags = a . tags a = a . boundingPoints b = b . boundingPoints if ( ! a || ! b ) return { x : 0 , y : 0 , z : 0 } // check if the furniture's virtual origin should be center or edge var isEdgeAligned = edgeAligned . some ( function ( t ) { return tags . includes ( t ) } ) var zOffset // compute offset between edges or centers if ( isEdgeAligned ) zOffset = a . min [ 2 ] - b . min [ 2 ] else zOffset = ( a . max [ 2 ] + a . min [ 2 ] ) / 2 - ( b . max [ 2 ] + b . min [ 2 ] ) / 2 var offset = { // compute offset between centers x : ( a . max [ 0 ] + a . min [ 0 ] ) / 2 - ( b . max [ 0 ] + b . min [ 0 ] ) / 2 , y : 0 , z : zOffset } return offset }
get offset based on bounding boxes
get offset based on bounding boxes