func (l loopRegion) IntersectsCell(c s2.Cell) bool { // Quick check if the cell intersects the bounding box if !l.RectBound().IntersectsCell(c) { return false } // Quick check to see if the first vertex is in the loop. if l.ContainsPoint(c.Vertex(0)) { return true } // At this stage the one vertex is outside the loop. We check if any of the edges of the cell // cross the loop. if l.edgesCross(c) { return true } // At this stage we know that there is one point of the cell outside the loop and the boundaries // do not interesect. The only way for the cell to intersect with the loop is if it contains the // the loop. We test this by checking if an arbitrary vertex of the loop is inside the cell. if c.RectBound().Contains(l.RectBound()) { return c.ContainsPoint(l.Vertex(0)) } return false }