demos/Collage/fabric.js
function(other) {
      // extracts coords
      function getCoords(oCoords) {
        return {
          tl: new fabric.Point(oCoords.tl.x, oCoords.tl.y),
          tr: new fabric.Point(oCoords.tr.x, oCoords.tr.y),
          bl: new fabric.Point(oCoords.bl.x, oCoords.bl.y),
          br: new fabric.Point(oCoords.br.x, oCoords.br.y)
        }
      }
      var thisCoords = getCoords(this.oCoords),
          otherCoords = getCoords(other.oCoords);

      var intersection = fabric.Intersection.intersectPolygonPolygon(
        [thisCoords.tl, thisCoords.tr, thisCoords.br, thisCoords.bl],
        [otherCoords.tl, otherCoords.tr, otherCoords.br, otherCoords.bl]
      );

      return (intersection.status === 'Intersection');
    }
function(other) {
      // extracts coords
      function getCoords(oCoords) {
        return {
          tl: new fabric.Point(oCoords.tl.x, oCoords.tl.y),
          tr: new fabric.Point(oCoords.tr.x, oCoords.tr.y),
          bl: new fabric.Point(oCoords.bl.x, oCoords.bl.y),
          br: new fabric.Point(oCoords.br.x, oCoords.br.y)
        }
      }
      var thisCoords = getCoords(this.oCoords),
          otherCoords = getCoords(other.oCoords);

      var intersection = fabric.Intersection.intersectPolygonPolygon(
        [thisCoords.tl, thisCoords.tr, thisCoords.br, thisCoords.bl],
        [otherCoords.tl, otherCoords.tr, otherCoords.br, otherCoords.bl]
      );

      return (intersection.status === 'Intersection');
    }
function ( other ) { // extracts coords function getCoords ( oCoords ) { return { tl : new fabric . Point ( oCoords . tl . x , oCoords . tl . y ) , tr : new fabric . Point ( oCoords . tr . x , oCoords . tr . y ) , bl : new fabric . Point ( oCoords . bl . x , oCoords . bl . y ) , br : new fabric . Point ( oCoords . br . x , oCoords . br . y ) } } var thisCoords = getCoords ( this . oCoords ) , otherCoords = getCoords ( other . oCoords ) ; var intersection = fabric . Intersection . intersectPolygonPolygon ( [ thisCoords . tl , thisCoords . tr , thisCoords . br , thisCoords . bl ] , [ otherCoords . tl , otherCoords . tr , otherCoords . br , otherCoords . bl ] ) ; return ( intersection . status === 'Intersection' ) ; }
Returns true if object intersects with another object
@method intersectsWithObject
@param {Object} other Object to test
@return {Boolean}
Returns true if object intersects with another object