Пример #1
0
// Check if there any entities in rt that intersect the Rect r, ignoring the spatial entity s.
func hasIntersectionsOtherThanSelf(rt *rtreego.Rtree, r *rtreego.Rect, self rtreego.Spatial) bool {
	results := rt.SearchIntersect(r)
	switch {
	case len(results) == 0:
		return false // intersects nothing
	case len(results) == 1:
		if results[0] == self {
			return false // intersects only itself
		} else {
			return true // intersects another entity
		}
	default:
		return true // intersects more than one entity
	}
}
Пример #2
0
// TODO eventually update this to check for actual intersections of cells, not just the bounding box
func hasIntersections(rt *rtreego.Rtree, r *rtreego.Rect) bool {
	results := rt.SearchIntersect(r)
	return len(results) > 0
}