MCPcopy
hub / github.com/golang/geo / bruteForceContainsPoint

Method bruteForceContainsPoint

s2/loop.go:590–598  ·  view source on GitHub ↗

bruteForceContainsPoint reports if the given point is contained by this loop. This method does not use the ShapeIndex, so it is only preferable below a certain size of loop.

(p Point)

Source from the content-addressed store, hash-verified

588// This method does not use the ShapeIndex, so it is only preferable below a certain
589// size of loop.
590func (l *Loop) bruteForceContainsPoint(p Point) bool {
591 origin := OriginPoint()
592 inside := l.originInside
593 crosser := NewChainEdgeCrosser(origin, p, l.Vertex(0))
594 for i := 1; i <= len(l.vertices); i++ { // add vertex 0 twice
595 inside = inside != crosser.EdgeOrVertexChainCrossing(l.Vertex(i))
596 }
597 return inside
598}
599
600// ContainsPoint returns true if the loop contains the point.
601func (l *Loop) ContainsPoint(p Point) bool {

Callers 2

ContainsPointMethod · 0.95
ContainsPointMethod · 0.80

Calls 4

VertexMethod · 0.95
OriginPointFunction · 0.85
NewChainEdgeCrosserFunction · 0.85

Tested by

no test coverage detected