Returns whether the given rectangle intersects the render target area of this surface.
774354
public boolean intersects (float x, float y, float w, float h) {
    tx().transform(intersectionTestPoint.set(x, y), intersectionTestPoint);
    tx().transform(intersectionTestSize.set(w, h), intersectionTestSize);
    float ix = intersectionTestPoint.x, iy = intersectionTestPoint.y;
    float iw = intersectionTestSize.x, ih = intersectionTestSize.y;

    if (scissorDepth > 0) {
      Rectangle scissor = scissors.get(scissorDepth - 1);
      return scissor.intersects((int)ix, (int)iy, (int)iw, (int)ih);
    }

    float tw = target.width(), th = target.height();
    return (ix + iw > 0) && (ix < tw) && (iy + ih > 0) && (iy < th);
  }
384543
public boolean intersects(long minimum, long supremum) {
    rangeSanityCheck(minimum, supremum);
    short minKey = Util.highbits(minimum);
    short supKey = Util.highbits(supremum);
    int len = highLowContainer.size;
    short[] keys = highLowContainer.keys;
    // seek to start
    int index = Util.unsignedBinarySearch(keys, 0, len, minKey);
    int pos = index >= 0 ? index : -index - 1;
    short offset = Util.lowbits(minimum);
    while (pos < len && Util.compareUnsigned(supKey, keys[pos]) > 0) {
      Container container = highLowContainer.getContainerAtIndex(pos);
      if (container.intersects(offset, 1 << 16)) {
        return true;
      }
      offset = 0;
      ++pos;
    }
    return pos < len
            && supKey == keys[pos]
            && highLowContainer.getContainerAtIndex(pos)
                               .intersects(0, (int)((supremum - 1) & 0xFFFF) + 1);
  }
5243
public boolean intersects(final Span s) {
    final int sstart = s.getStart();
    // either s's start is in this or this' start is in s
    return this.contains(s) || s.contains(this)
        || getStart() <= sstart && sstart < getEnd()
        || sstart <= getStart() && getStart() < s.getEnd();
  }
846823
public static boolean checkCollision(CmsPositionBean posA, CmsPositionBean posB, int margin) {

        // check for non collision is easier
        if ((posA.getLeft() - margin) >= (posB.getLeft() + posB.getWidth())) {
            // posA is right of posB
            return false;
        }
        if ((posA.getLeft() + posA.getWidth()) <= (posB.getLeft() - margin)) {
            // posA is left of posB
            return false;
        }
        if ((posA.getTop() - margin) >= (posB.getTop() + posB.getHeight())) {
            // posA is bellow posB
            return false;
        }
        if ((posA.getTop() + posA.getHeight()) <= (posB.getTop() - margin)) {
            // posA is above posB
            return false;
        }

        // in any other case the position rectangles collide
        return true;
    }
850743
function(el) {
      var intersect = false;
      if (el.getBoundingClientRect) {
        var elRect = el.getBoundingClientRect();
        intersect = {'top': Math.max(elRect.top, 0),
                         'left': Math.max(elRect.left, 0),
                         'bottom': Math.min(elRect.bottom, (win.innerHeight || doc.documentElement.clientHeight)),
                         'right': Math.min(elRect.right, (win.innerWidth || doc.documentElement.clientWidth))};
        if (intersect.bottom <= intersect.top ||
            intersect.right <= intersect.left) {
          intersect = false;
        } else {
          intersect.area = (intersect.bottom - intersect.top) * (intersect.right - intersect.left);
        }
      }
      return intersect;
    }
84680
def rounded_rectangle_region(width, height, radius):
  
  bmp = wx.Bitmap.FromRGBA(width, height) # Mask color is #000000
  dc = wx.MemoryDC(bmp)
  dc.Brush = wx.Brush((255,) * 3) # Any non-black would do
  dc.DrawRoundedRectangle(0, 0, width, height, radius)
  dc.SelectObject(wx.NullBitmap)
  bmp.SetMaskColour((0,) * 3)
  return wx.Region(bmp)
233607
function getIntersectionRect (rect1, rect2) {
  const intersectRect = {
    topLeft: {},
    bottomRight: {}
  };

  if (!doesIntersect(rect1, rect2)) {
    return;
  }

  const rect1Points = rectToPoints(rect1);
  const rect2Points = rectToPoints(rect2);

  if (rect1.width >= 0) {
    if (rect2.width >= 0) {
      intersectRect.topLeft.x = Math.max(rect1Points.topLeft.x, rect2Points.topLeft.x);
      intersectRect.bottomRight.x = Math.min(rect1Points.bottomRight.x, rect2Points.bottomRight.x);
    } else {
      intersectRect.topLeft.x = Math.max(rect1Points.topLeft.x, rect2Points.bottomRight.x);
      intersectRect.bottomRight.x = Math.min(rect1Points.bottomRight.x, rect2Points.topLeft.x);
    }
  } else if (rect2.width >= 0) {
    intersectRect.topLeft.x = Math.min(rect1Points.topLeft.x, rect2Points.bottomRight.x);
    intersectRect.bottomRight.x = Math.max(rect1Points.bottomRight.x, rect2Points.topLeft.x);
  } else {
    intersectRect.topLeft.x = Math.min(rect1Points.topLeft.x, rect2Points.topLeft.x);
    intersectRect.bottomRight.x = Math.max(rect1Points.bottomRight.x, rect2Points.bottomRight.x);
  }

  if (rect1.height >= 0) {
    if (rect2.height >= 0) {
      intersectRect.topLeft.y = Math.max(rect1Points.topLeft.y, rect2Points.topLeft.y);
      intersectRect.bottomRight.y = Math.min(rect1Points.bottomRight.y, rect2Points.bottomRight.y);
    } else {
      intersectRect.topLeft.y = Math.max(rect1Points.topLeft.y, rect2Points.bottomRight.y);
      intersectRect.bottomRight.y = Math.min(rect1Points.bottomRight.y, rect2Points.topLeft.y);
    }
  } else if (rect2.height >= 0) {
    intersectRect.topLeft.y = Math.min(rect1Points.topLeft.y, rect2Points.bottomRight.y);
    intersectRect.bottomRight.y = Math.max(rect1Points.bottomRight.y, rect2Points.topLeft.y);
  } else {
    intersectRect.topLeft.y = Math.min(rect1Points.topLeft.y, rect2Points.topLeft.y);
    intersectRect.bottomRight.y = Math.max(rect1Points.bottomRight.y, rect2Points.bottomRight.y);
  }

  // Returns top-left and bottom-right points of intersected rectangle
  return intersectRect;

}
659101
private static boolean checkVerticesForIntersection_(
			MultiVertexGeometryImpl geom, RasterizedGeometry2D rgeom) {
		// Do a quick raster test for each point. If any point is inside, then
		// there is an intersection.
		int pointCount = geom.getPointCount();
		Point2D pt = new Point2D();
		for (int ipoint = 0; ipoint < pointCount; ipoint++) {
			geom.getXY(ipoint, pt);
			RasterizedGeometry2D.HitType hit = rgeom.queryPointInGeometry(pt.x,
					pt.y);
			if (hit == RasterizedGeometry2D.HitType.Inside) {
				return true;
			}
		}

		return false;
	}
1034681
function(rectangle) {
        return $.Rect.fromSummits(
            this.pixelFromPoint(rectangle.getTopLeft(), true),
            this.pixelFromPoint(rectangle.getTopRight(), true),
            this.pixelFromPoint(rectangle.getBottomLeft(), true)
        );
    }
561712
@Override
	@Pure
	public boolean intersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
		if (boundsIntersects(rectangle)) {
			final double x = getX();
			final double y = getY();
			final Rectangle2afp<?, ?, ?, ?, ?, ?> box = rectangle.toBoundingBox();
			final double minx = box.getMinX();
			final double miny = box.getMinY();
			final double maxx = box.getMaxX();
			final double maxy = box.getMaxY();

			return MathUtil.min(
					Segment2afp.calculatesDistanceSegmentPoint(minx, miny, maxx, miny, x, y),
					Segment2afp.calculatesDistanceSegmentPoint(minx, miny, minx, maxy, x, y),
					Segment2afp.calculatesDistanceSegmentPoint(maxx, miny, maxx, maxy, x, y),
					Segment2afp.calculatesDistanceSegmentPoint(minx, maxy, maxx, maxy, x, y)) <= this.radius;
		}
		return false;
	}
1133023
public boolean intersects(Shape shape) {
        if(shape instanceof Circle) {
            Circle other = (Circle)shape;
    		float totalRad2 = getRadius() + other.getRadius();
    		
    		if (Math.abs(other.getCenterX() - getCenterX()) > totalRad2) {
    			return false;
    		}
    		if (Math.abs(other.getCenterY() - getCenterY()) > totalRad2) {
    			return false;
    		}
    		
    		totalRad2 *= totalRad2;
    		
    		float dx = Math.abs(other.getCenterX() - getCenterX());
    		float dy = Math.abs(other.getCenterY() - getCenterY());
    		
    		return totalRad2 >= ((dx*dx) + (dy*dy));
        }
        else if(shape instanceof Rectangle) {
            return intersects((Rectangle)shape);
        }
        else {
            return super.intersects(shape);
        }
	}
648155
function intersects(num, pos, angle)
{
    angle %= 4;
    var fig = getTransformedFigure(num, angle, pos);
    for (var i=0; i < fig.length; i+= 2)
    {
        var x = fig[i];
        var y = fig[i+1]
        if (y < 0)
            return true;
        if (x < 0)
            return true;
        if (x >= cupsize[0])
            return true;
        if (y >= cupsize[1])
            return true;
        if (cup[x + y*cupsize[0]])
            return true;
    }
    return false;
}
533178
protected boolean intersectsY (IRay3 ray, float y) {
        IVector3 origin = ray.origin(), dir = ray.direction();
        float t = (y - origin.y()) / dir.y();
        if (t < 0f) {
            return false;
        }
        float ix = origin.x() + t*dir.x(), iz = origin.z() + t*dir.z();
        return ix >= _minExtent.x && ix <= _maxExtent.x &&
            iz >= _minExtent.z && iz <= _maxExtent.z;
    }
1334387
def rectangle(self, x, y, width, height, corner_radius = 0):
        """"""
        if corner_radius <= 0:
            self._add_instruction("rectangle", x, y, width, height)
            return

        # convert into 4 border and  make sure that w + h are larger than 2 * corner_radius
        if isinstance(corner_radius, (int, float)):
            corner_radius = [corner_radius] * 4
        corner_radius = [min(r, min(width, height) / 2) for r in corner_radius]

        x2, y2 = x + width, y + height
        self._rounded_rectangle(x, y, x2, y2, corner_radius)
714504
public boolean intersects(Geometry geometry) {
		if (isEmpty()) {
			return false;
		}
		for (LineString lineString : lineStrings) {
			if (lineString.intersects(geometry)) {
				return true;
			}
		}

		return false;
	}
437566
def set_rectangle(self, rectangle):
        
        if rectangle == self.rectangle():
            return False

        if rectangle is None:
            self.reset()
        else:
            self.start_point = QgsPointXY(
                rectangle.xMinimum(), rectangle.yMinimum())
            self.end_point = QgsPointXY(
                rectangle.xMaximum(), rectangle.yMaximum())
            self.show_rectangle(self.start_point, self.end_point)
        return True
1097836
function doesIntersect (rect1, rect2) {
  let intersectLeftRight;
  let intersectTopBottom;

  const rect1Points = rectToPoints(rect1);
  const rect2Points = rectToPoints(rect2);

  if (rect1.width >= 0) {
    if (rect2.width >= 0) {
      intersectLeftRight = !((rect1Points.bottomRight.x <= rect2Points.topLeft.x) || (rect2Points.bottomRight.x <= rect1Points.topLeft.x));
    } else {
      intersectLeftRight = !((rect1Points.bottomRight.x <= rect2Points.bottomRight.x) || (rect2Points.topLeft.x <= rect1Points.topLeft.x));
    }
  } else if (rect2.width >= 0) {
    intersectLeftRight = !((rect1Points.topLeft.x <= rect2Points.topLeft.x) || (rect2Points.bottomRight.x <= rect1Points.bottomRight.x));
  } else {
    intersectLeftRight = !((rect1Points.topLeft.x <= rect2Points.bottomRight.x) || (rect2Points.topLeft.x <= rect1Points.bottomRight.x));
  }

  if (rect1.height >= 0) {
    if (rect2.height >= 0) {
      intersectTopBottom = !((rect1Points.bottomRight.y <= rect2Points.topLeft.y) || (rect2Points.bottomRight.y <= rect1Points.topLeft.y));
    } else {
      intersectTopBottom = !((rect1Points.bottomRight.y <= rect2Points.bottomRight.y) || (rect2Points.topLeft.y <= rect1Points.topLeft.y));
    }
  } else if (rect2.height >= 0) {
    intersectTopBottom = !((rect1Points.topLeft.y <= rect2Points.topLeft.y) || (rect2Points.bottomRight.y <= rect1Points.bottomRight.y));
  } else {
    intersectTopBottom = !((rect1Points.topLeft.y <= rect2Points.bottomRight.y) || (rect2Points.top <= rect1Points.bottomRight.y));
  }

  return intersectLeftRight && intersectTopBottom;
}