iteratorContainsPoint reports if the iterator that is positioned at the ShapeIndexCell that may contain p, contains the point p.
(it *ShapeIndexIterator, p Point)
| 718 | // iteratorContainsPoint reports if the iterator that is positioned at the ShapeIndexCell |
| 719 | // that may contain p, contains the point p. |
| 720 | func (l *Loop) iteratorContainsPoint(it *ShapeIndexIterator, p Point) bool { |
| 721 | // Test containment by drawing a line segment from the cell center to the |
| 722 | // given point and counting edge crossings. |
| 723 | aClipped := it.IndexCell().findByShapeID(0) |
| 724 | inside := aClipped.containsCenter |
| 725 | if len(aClipped.edges) > 0 { |
| 726 | center := it.Center() |
| 727 | crosser := NewEdgeCrosser(center, p) |
| 728 | aiPrev := -2 |
| 729 | for _, ai := range aClipped.edges { |
| 730 | if ai != aiPrev+1 { |
| 731 | crosser.RestartAt(l.Vertex(ai)) |
| 732 | } |
| 733 | aiPrev = ai |
| 734 | inside = inside != crosser.EdgeOrVertexChainCrossing(l.Vertex(ai+1)) |
| 735 | } |
| 736 | } |
| 737 | return inside |
| 738 | } |
| 739 | |
| 740 | // RegularLoop creates a loop with the given number of vertices, all |
| 741 | // located on a circle of the specified radius around the given center. |
no test coverage detected