intersection with another patch
978527
def intersection(self,other):
        ""
        res = {}
        if set(self.sets.keys()) != set(other.sets.keys()):
            raise KeyError('Incompatible patches in intersection')
        for name,s1 in self.sets.items():
            s2 = other.sets[name]
            res[name] = s1.intersection(s2)
        return Patch(res)
878155
function (coord, ringAndEdge1, ringAndEdge2, nxtIsectAlongRingAndEdge1, nxtIsectAlongRingAndEdge2, ringAndEdge1Walkable, ringAndEdge2Walkable) {
  this.coord = coord; // [x,y] of this intersection
  this.ringAndEdge1 = ringAndEdge1; // first edge of this intersection
  this.ringAndEdge2 = ringAndEdge2; // second edge of this intersection
  this.nxtIsectAlongRingAndEdge1 = nxtIsectAlongRingAndEdge1; // the next intersection when following ringAndEdge1
  this.nxtIsectAlongRingAndEdge2 = nxtIsectAlongRingAndEdge2; // the next intersection when following ringAndEdge2
  this.ringAndEdge1Walkable = ringAndEdge1Walkable; // May we (still) walk away from this intersection over ringAndEdge1?
  this.ringAndEdge2Walkable = ringAndEdge2Walkable; // May we (still) walk away from this intersection over ringAndEdge2?
}
413465
def intersection(ir):
        
        x = max(self.getX(), ur.getX())
        y = max(self.getY(), ur.getY())
        w = min(self.getBottomRight().x, ur.getBottomRight().x) - x
        h = min(self.getBottomRight().y, ur.getBottomRight().y) - y
        if w > 0 and h > 0:
            return Region(x, y, w, h)
        return None
928220
public void intersect (Area area) {
        if (area == null) {
            return;
        } else if (isEmpty() || area.isEmpty()) {
            reset();
            return;
        }

        if (isPolygonal() && area.isPolygonal()) {
            intersectPolygon(area);
        } else {
            intersectCurvePolygon(area);
        }

        if (areaBoundsSquare() < GeometryUtil.EPSILON) {
            reset();
        }
    }
19380
def find_next_intersection(edges, i, e)
	    for j in i..(edges.count-1)
		e2 = edges[j][:edge]
		next if !e2 || e.connected?(e2)
		intersection = e.intersection(e2)
		return [intersection, j] if intersection
	    end
	    nil
	end
192606
function intersects (frame, otherFrame) {
  return !(otherFrame.x > frame.x + frame.width ||
           otherFrame.x + otherFrame.width < frame.x ||
           otherFrame.y > frame.y + frame.height ||
           otherFrame.y + otherFrame.height < frame.y);
}
668091
def intersection_update(self, *others):
        
        return self._op_update_helper(
            tuple(others), operator.and_, 'sinterstore', update=True
        )
420503
def intersection_update(self, other):
        
        if not isinstance(other, Set):
            raise ValueError('other must be a Set instance')
        if self is other:
            return
        # we make a copy of the list so that we can remove items from
        # the list without breaking the iterator.
        for item in list(self.items):
            if item not in other.items:
                self.items.remove(item)
834691
function intersection(xArr, yArr, xFilter, yFilter, invert) {
        var i, j, n, filteredX, filteredY, out = invert ? [].concat(xArr) : [];

        for (i = 0, n = xArr.length; i < xArr.length; i++) {
            filteredX = xFilter ? xFilter(xArr[i]) : xArr[i];

            for (j = 0; j < yArr.length; j++) {
                filteredY = yFilter ? yFilter(yArr[j]) : yArr[j];

                if (angular.equals(filteredX, filteredY, xArr, yArr, i, j)) {
                    invert ? out.splice(i + out.length - n, 1) : out.push(yArr[j]);
                    break;
                }
            }
        }
        return out;
    }
313225
def _intersection(d1,d2):
    '''
        
    '''
    i = {}
    ds = _diff_internal(d1,d2)
    for key in ds['same']:
        i[key] = d1[key]
    return(i)
348010
function intersects (data, p1, q1, p2, q2) {
  return orient(data, p1, q1, p2) !== orient(data, p1, q1, q2) &&
    orient(data, p2, q2, p1) !== orient(data, p2, q2, q1)
}
919876
public boolean intersect(Envelope3D other) {
		if (isEmpty() || other.isEmpty())
			return false;

		if (other.xmin > xmin)
			xmin = other.xmin;

		if (other.xmax < xmax)
			xmax = other.xmax;

		if (other.ymin > ymin)
			ymin = other.ymin;

		if (other.ymax < ymax)
			ymax = other.ymax;

		if (other.zmin > zmin)
			zmin = other.zmin;

		if (other.zmax < zmax)
			zmax = other.zmax;

		boolean bIntersecting = xmin <= xmax && ymin <= ymax && zmin <= zmax;

		if (!bIntersecting)
			setEmpty();

		return bIntersecting;
	}
926913
function lineRectangleIntersection(line, rect) {
  const intersections = [];

  Object.keys(rect).forEach(function(side) {
    const segment = rect[side];
    const intersection = line.intersectLine(segment);

    if (intersection) {
      intersections.push(intersection);
    }
  });

  return intersections;
}
131495
def intersect(self, r):
        """"""
        if not len(r) == 4:
            raise ValueError("bad sequ. length")
        self.x0, self.y0, self.x1, self.y1 = TOOLS._intersect_rect(self, r)
        return self
773255
public void intersect(OpenBitSet other) {
        int newLen= Math.min(this.wlen,other.wlen);
        long[] thisArr = this.bits;
        long[] otherArr = other.bits;
        // testing against zero can be more efficient
        int pos=newLen;
        while(--pos>=0) {
            thisArr[pos] &= otherArr[pos];
        }
        if (this.wlen > newLen) {
            // fill zeros from the new shorter length to the old length
            Arrays.fill(bits,newLen,this.wlen,0);
        }
        this.wlen = newLen;
    }
10993
function intersect(a, b, not) {
  return a.filter((c) => {
    const index = ~indexOfDeclaration(b, c);
    return not ? !index : index;
  });
}
468702
public Bbox intersection(Bbox other) {
		if (!this.intersects(other)) {
			return null;
		} else {
			double minx = other.getX() > this.getX() ? other.getX() : this.getX();
			double maxx = other.getEndPoint().getX() < this.getEndPoint().getX() ? other.getEndPoint().getX() : this
					.getEndPoint().getX();
			double miny = other.getY() > this.getY() ? other.getY() : this.getY();
			double maxy = other.getEndPoint().getY() < this.getEndPoint().getY() ? other.getEndPoint().getY() : this
					.getEndPoint().getY();
			return new Bbox(minx, miny, (maxx - minx), (maxy - miny));
		}
	}