Loop represents a simple spherical polygon. It consists of a sequence of vertices where the first vertex is implicitly connected to the last. All loops are defined to have a CCW orientation, i.e. the interior of the loop is on the left side of the edges. This implies that a clockwise loop enclosing
| 43 | // chain, they are defined as having exactly one vertex each (see EmptyLoop |
| 44 | // and FullLoop). |
| 45 | type Loop struct { |
| 46 | vertices []Point |
| 47 | |
| 48 | // originInside keeps a precomputed value whether this loop contains the origin |
| 49 | // versus computing from the set of vertices every time. |
| 50 | originInside bool |
| 51 | |
| 52 | // depth is the nesting depth of this Loop if it is contained by a Polygon |
| 53 | // or other shape and is used to determine if this loop represents a hole |
| 54 | // or a filled in portion. |
| 55 | depth int |
| 56 | |
| 57 | // bound is a conservative bound on all points contained by this loop. |
| 58 | // If l.ContainsPoint(P), then l.bound.ContainsPoint(P). |
| 59 | bound Rect |
| 60 | |
| 61 | // Since bound is not exact, it is possible that a loop A contains |
| 62 | // another loop B whose bounds are slightly larger. subregionBound |
| 63 | // has been expanded sufficiently to account for this error, i.e. |
| 64 | // if A.Contains(B), then A.subregionBound.Contains(B.bound). |
| 65 | subregionBound Rect |
| 66 | |
| 67 | // index is the spatial index for this Loop. |
| 68 | index *ShapeIndex |
| 69 | } |
| 70 | |
| 71 | // LoopFromPoints constructs a loop from the given points. |
| 72 | func LoopFromPoints(pts []Point) *Loop { |
nothing calls this directly
no outgoing calls
no test coverage detected