Check to see if two AABoundingBoxes are colliding.
777401
def is_colliding(self, other):
        """"""
        if isinstance(other, AABoundingBox):
            if self.rect.colliderect(other.rect):
                return True
            return False
858759
def _merge_any_two_boxes(self, box_list):
        """"""
        n = len(box_list)
        for i in range(n):
            for j in range(i + 1, n):
                if self._are_nearby_parallel_boxes(box_list[i], box_list[j]):
                    # Remove the two boxes from the list, add a new one
                    a, b = box_list[i], box_list[j]
                    merged_points = np.vstack([a.points, b.points])
                    merged_box = RotatedBox.from_points(merged_points, self.box_type)
                    if merged_box.width / merged_box.height >= self.min_box_aspect:
                        box_list.remove(a)
                        box_list.remove(b)
                        box_list.append(merged_box)
                        return True
        return False
1212379
def bbox_vert_aligned(box1, box2):
    
    if not (box1 and box2):
        return False
    # NEW: any overlap counts
    #    return box1.left <= box2.right and box2.left <= box1.right
    box1_left = box1.left + 1.5
    box2_left = box2.left + 1.5
    box1_right = box1.right - 1.5
    box2_right = box2.right - 1.5
    return not (box1_left > box2_right or box2_left > box1_right)
493027
public static <T> boolean intersectsAll(T[] a1, T[] a2) {
        for (T anA1 : a1) {
            if (!contains(a2, anA1)) {
                return false;
            }
        }

        for (T anA2 : a2) {
            if (!contains(a1, anA2)) {
                return false;
            }
        }

        return true;
    }
836508
def bounds_overlap(bound1, bound2):
    ''''''
    (x1,y1,w1,h1) = bound1
    (x2,y2,w2,h2) = bound2
    if x1+w1 < x2:
        return False
    if x2+w2 < x1:
        return False
    if y1+h1 < y2:
        return False
    if y2+h2 < y1:
        return False
    return True
1169460
@Override
  public boolean intersects(IVersionRange yourRange)
  {
    // If the supplied set is a version set, let it deal with it
    if (yourRange instanceof VersionSet) {
      return yourRange.intersects(this);
    }
    // If the other range is a simple range, then we can just check the extremities
    // to see if they overlap
    else if (yourRange instanceof VersionRange) {
      IVersion useMyVersion = null;
      switch (operator) {
        case ">":
          useMyVersion = version.getNextVersion();
          break;
        case "<":
          useMyVersion = version.getPrevVersion();
          break;
        default:
          useMyVersion = version;
          break;
      }
      if (yourRange.contains(useMyVersion)) {
        return true;
      }

      IVersion useYourVersion = null;
      switch (((VersionRange) yourRange).operator) {
        case ">":
          useYourVersion = ((VersionRange) yourRange).version.getNextVersion();
          break;
        case "<":
          useYourVersion = ((VersionRange) yourRange).version.getPrevVersion();
          break;
        default:
          useYourVersion = ((VersionRange) yourRange).version;
          break;
      }
      if (this.contains(useYourVersion)) {
        return true;
      }

      // Special case: Versions right next to each other >1.2.6 & <1.2.7
      // There may be micro-versions or snapshot versions between them
      if (this.version.equals(useYourVersion) && ((VersionRange) yourRange).version.equals(useMyVersion)) {
        return true;
      }
    }
    // Logical ranges need to be broken down
    else if (yourRange instanceof AndRange) {
      return yourRange.intersects(this);
    }
    else if (yourRange instanceof OrRange) {
      return yourRange.intersects(this);
    }
    else {
      throw new UnsupportedOperationException();
    }
    return false;
  }
285116
private boolean checkDimensions(CLIQUEUnit other, int e) {
    for(int i = 0, j = 0; i < e; i++, j += 2) {
      if(dims[i] != other.dims[i] || bounds[j] != other.bounds[j] || bounds[j + 1] != bounds[j + 1]) {
        return false;
      }
    }
    return true;
  }
1243078
public boolean intersects(Bbox other) {
		if (other.getX() > this.getEndPoint().getX()) {
			return false;
		}
		if (other.getY() > this.getEndPoint().getY()) {
			return false;
		}
		if (other.getEndPoint().getX() < this.getX()) {
			return false;
		}
		if (other.getEndPoint().getY() < this.getY()) {
			return false;
		}
		return true;
	}
439184
def collides(self, other):
        """"""

        angle = self.angle
        width = self.width
        height = self.height

        if angle == 0:
            return other.collides(Rect(-0.5 * width,
                                       -0.5 * height, width, height))

        # Phase 1
        #
        #  * Form bounding box on tilted rectangle P.
        #  * Check whether bounding box and other intersect.
        #  * If not, then self and other do not intersect.
        #  * Otherwise proceed to Phase 2.

        # Now perform the standard rectangle intersection test.

        if self.is_bbox_not_intersecting(other):
            return False

        # Phase 2
        #
        # If we get here, check the edges of self to see
        #  * if one of them excludes all vertices of other.
        #  * If so, then self and other do not intersect.
        #  * (If not, then self and other do intersect.)

        return not self.is_edge_not_excluding_vertices(other)
551747
def is_full_overlap(self1):
      
      if len(self1.overs) == 0: return False
      if len(self1.dif1) > 0:
        if max(self1.dif1) != 1 or max(self1.dif2) != 1: return False
      if self1.start1 and self1.end1 and self1.start2 and self1.end2:
        return True
      return False
145612
def overlap(self, other):
        """"""
        if self._start < other.end and self._end > other.start:
            return True
        return False
787917
def Intersect(self, other):
        
        if isinstance(other, Range):
            max_low = self.low if (self.low >= other.low) else other.low
            min_high = self.high if (self.high <= other.high) else other.high

            if max_low <= min_high:
                return True

        return False
1150755
def check_name_collision( self, name, block_id, checked_ops ):
        

        return self.check_collision( "name", name, block_id, checked_ops, OPCODE_NAME_STATE_CREATIONS )
1197555
protected boolean checkCollision() {

        // sort the positions by their left x coordinate, so we can easily exclude
        // pairs of positions which don't overlap horizontally
        sortByLeft();
        int i;
        for (i = 0; i < m_positions.size(); i++) {
            for (int j = i + 1; (j < m_positions.size())
                && intersectsHorizontally(m_positions.get(i), m_positions.get(j)); j++) {
                if (intersectsVertically(m_positions.get(i), m_positions.get(j))) {
                    handleCollision(m_positions.get(i), m_positions.get(j));
                    return true;
                }
            }
        }
        return false;
    }
194706
def boxes_intersect(box1, box2):
    """"""
    xmin1, xmax1, ymin1, ymax1 = box1
    xmin2, xmax2, ymin2, ymax2 = box2
    if interval_intersection_width(xmin1, xmax1, xmin2, xmax2) and \
            interval_intersection_width(ymin1, ymax1, ymin2, ymax2):
        return True
    else:
        return False
122132
public static boolean intersects(Bbox one, Bbox two) {
		if (two.getX() > one.getMaxX()) {
			return false;
		}
		if (two.getY() > one.getMaxY()) {
			return false;
		}
		if (two.getMaxX() < one.getX()) {
			return false;
		}
		if (two.getMaxY() < one.getY()) {
			return false;
		}
		return true;
	}
635955
public static boolean intersects(final RoaringBitmap x1, final RoaringBitmap x2) {
    final int length1 = x1.highLowContainer.size(), length2 = x2.highLowContainer.size();
    int pos1 = 0, pos2 = 0;

    while (pos1 < length1 && pos2 < length2) {
      final short s1 = x1.highLowContainer.getKeyAtIndex(pos1);
      final short s2 = x2.highLowContainer.getKeyAtIndex(pos2);
      if (s1 == s2) {
        final Container c1 = x1.highLowContainer.getContainerAtIndex(pos1);
        final Container c2 = x2.highLowContainer.getContainerAtIndex(pos2);
        if (c1.intersects(c2)) {
          return true;
        }
        ++pos1;
        ++pos2;
      } else if (Util.compareUnsigned(s1, s2) < 0) { // s1 < s2
        pos1 = x1.highLowContainer.advanceUntil(s2, pos1);
      } else { // s1 > s2
        pos2 = x2.highLowContainer.advanceUntil(s1, pos2);
      }
    }
    return false;
  }