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)
| 588 | // This method does not use the ShapeIndex, so it is only preferable below a certain |
| 589 | // size of loop. |
| 590 | func (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. |
| 601 | func (l *Loop) ContainsPoint(p Point) bool { |
no test coverage detected