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

Struct Loop

s2/loop.go:45–69  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

43// chain, they are defined as having exactly one vertex each (see EmptyLoop
44// and FullLoop).
45type 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.
72func LoopFromPoints(pts []Point) *Loop {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected