// Intersects reports whether this cap intersects the other cap.
// i.e. whether they have any points in common.
352855
func (c Cap) Intersects(other Cap) bool {
	if c.IsEmpty() || other.IsEmpty() {
		return false
	}

	return c.Radius()+other.Radius() >= c.center.Distance(other.center)
}
452099
func (i Interval) Intersects(oi Interval) bool {
	if i.IsEmpty() || oi.IsEmpty() {
		return false
	}
	if i.IsInverted() {
		return oi.IsInverted() || oi.Lo <= i.Hi || oi.Hi >= i.Lo
	}
	if oi.IsInverted() {
		return oi.Lo <= i.Hi || oi.Hi >= i.Lo
	}
	return oi.Lo <= i.Hi && oi.Hi >= i.Lo
}
714782
func (members Members) Intersect(otherMembers Members) Members {
	var res Members
	m := otherMembers.ByID()
	for _, member := range members {
		if _, exists := m[string(member.PKIid)]; exists {
			res = append(res, member)
		}
	}
	return res
}
414599
func (dst *Region) Intersect(other *Region) error {
	ret := Status(C.cairo_region_intersect(dst.Ptr, other.Ptr)).toError()
	if err := dst.status(); err != nil {
		panic(err)
	}
	return ret
}
1192770
func (b *Bound) Intersects(bound *Bound) bool {

	if (b.ne[0] < bound.sw[0]) ||
		(b.sw[0] > bound.ne[0]) ||
		(b.ne[1] < bound.sw[1]) ||
		(b.sw[1] > bound.ne[1]) {
		return false
	}

	return true
}
139362
func (p *Polygon) Intersects(o *Polygon) bool {
	// If both polygons have one loop, use the more efficient Loop method.
	// Note that Loop Intersects does its own bounding rectangle check.
	if len(p.loops) == 1 && len(o.loops) == 1 {
		return p.loops[0].Intersects(o.loops[0])
	}

	// Otherwise if neither polygon has holes, we can still use the more
	// efficient Loop.Intersects method. The polygons intersect if and
	// only if some pair of loop regions intersect.
	if !p.bound.Intersects(o.bound) {
		return false
	}

	if !p.hasHoles && !o.hasHoles {
		for _, l := range o.loops {
			if p.anyLoopIntersects(l) {
				return true
			}
		}
		return false
	}

	// Polygon A is disjoint from B if A excludes the entire boundary of B and B
	// excludes all shell boundaries of A. (It can be shown that B must then
	// exclude the entire boundary of A.) The first call below returns false if
	// the boundaries cross, therefore the second call does not need to check
	// for crossing edges.
	return !p.excludesBoundary(o) || !o.excludesNonCrossingShells(p)
}
118748
func (s *Set) Intersection(t *Set) *Set {
	// Copy current set, create a set of intersections between the sets
	intSet := s.Clone()

	// Get all differences between the sets
	for _, d := range s.Difference(t).Enumerate() {
		// Remove all different elements
		intSet.Remove(d)
	}

	return intSet
}
39497
func (l Line) Intersect(k Line) (Vec, bool) {
	// Check if the lines are parallel
	lDir := l.A.To(l.B)
	kDir := k.A.To(k.B)
	if lDir.X == kDir.X && lDir.Y == kDir.Y {
		return ZV, false
	}

	// The lines intersect - but potentially not within the line segments.
	// Get the intersection point for the lines if they were infinitely long, check if the point exists on both of the
	// segments
	lm, lb := l.Formula()
	km, kb := k.Formula()

	// Account for vertical lines
	if math.IsInf(math.Abs(lm), 1) && math.IsInf(math.Abs(km), 1) {
		// Both vertical, therefore parallel
		return ZV, false
	}

	var x, y float64

	if math.IsInf(math.Abs(lm), 1) || math.IsInf(math.Abs(km), 1) {
		// One line is vertical
		intersectM := lm
		intersectB := lb
		verticalLine := k

		if math.IsInf(math.Abs(lm), 1) {
			intersectM = km
			intersectB = kb
			verticalLine = l
		}

		y = intersectM*verticalLine.A.X + intersectB
		x = verticalLine.A.X
	} else {
		// Coordinates of intersect
		x = (kb - lb) / (lm - km)
		y = lm*x + lb
	}

	if l.Contains(V(x, y)) && k.Contains(V(x, y)) {
		// The intersect point is on both line segments, they intersect.
		return V(x, y), true
	}

	return ZV, false
}
1209649
func (obj *object) Intersect(other Object) [][3]*Term {
	r := [][3]*Term{}
	obj.Foreach(func(k, v *Term) {
		if v2 := other.Get(k); v2 != nil {
			r = append(r, [3]*Term{k, v, v2})
		}
	})
	return r
}
339339
func (s Set) Intersect(other Set) Set {
	smallLen := len(s)
	if lo := len(other); lo < smallLen {
		smallLen = lo
	}
	ret := make(Set, smallLen)
	for k := range s {
		if _, ok := other[k]; ok {
			ret[k] = struct{}{}
		}
	}
	return ret
}
232949
func (s *PortSpec) Overlaps(p *PortSpec) bool {
	a := p
	b := s
	if a.Min > b.Min {
		a = s
		b = p
	}
	if a.Max >= b.Min {
		return true
	}
	return false
}
1287591
func (s *set) Intersect(other Set) Set {
	o := other.(*set)
	n, m := s.Len(), o.Len()
	ss := s
	so := o
	if m < n {
		ss = o
		so = s
		n = m
	}

	r := newset(n)
	ss.Foreach(func(x *Term) {
		if so.Contains(x) {
			r.Add(x)
		}
	})
	return r
}
765074
func (r Rect) Intersect(s Rect) Rect {
	t := R(
		math.Max(r.Min.X, s.Min.X),
		math.Max(r.Min.Y, s.Min.Y),
		math.Min(r.Max.X, s.Max.X),
		math.Min(r.Max.Y, s.Max.Y),
	)
	if t.Min.X >= t.Max.X || t.Min.Y >= t.Max.Y {
		return Rect{}
	}
	return t
}
336509
func (s *mockServer) intersect(f messageInterceptor) {
	s.interceptorFuncs = append(s.interceptorFuncs, f)
}
1215540
func (d *Diet) Intersection(x, y uint64) uint64 {
	x, y = sortBoundaries(x, y)
	return intersection(x, y, d.root)
}
263523
func (r Region) Intersects(r2 Region) bool {
	return r.Intersection(r2).Size() > 0
}
902960
func (s1 StringSet) Intersect(s2 StringSet) StringSet {
	return setOperation(s1, s2, true)
}