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

Function PolygonFromLoops

s2/polygon.go:92–102  ·  view source on GitHub ↗

PolygonFromLoops constructs a polygon from the given set of loops. The polygon interior consists of the points contained by an odd number of loops. (Recall that a loop contains the set of points on its left-hand side.) This method determines the loop nesting hierarchy and assigns every loop a depth

(loops []*Loop)

Source from the content-addressed store, hash-verified

90// Note: The given set of loops are reordered by this method so that the hierarchy
91// can be traversed using Parent, LastDescendant and the loops depths.
92func PolygonFromLoops(loops []*Loop) *Polygon {
93 p := &Polygon{}
94 // Empty polygons do not contain any loops, even the Empty loop.
95 if len(loops) == 1 && loops[0].IsEmpty() {
96 p.initLoopProperties()
97 return p
98 }
99 p.loops = loops
100 p.initNested()
101 return p
102}
103
104// PolygonFromOrientedLoops returns a Polygon from the given set of loops,
105// like PolygonFromLoops. It expects loops to be oriented such that the polygon

Callers 15

earth_test.goFile · 0.92
PolygonFromOrientedLoopsFunction · 0.85
PolygonFromCellFunction · 0.85
concentricLoopsPolygonFunction · 0.85
checkPolygonInvalidFunction · 0.85
TestPolygonParentFunction · 0.85

Calls 3

initLoopPropertiesMethod · 0.95
initNestedMethod · 0.95
IsEmptyMethod · 0.65

Tested by 14

concentricLoopsPolygonFunction · 0.68
checkPolygonInvalidFunction · 0.68
TestPolygonParentFunction · 0.68
TestPolygonInvertFunction · 0.68
TestEdgeQueryMultiFaceFunction · 0.68
makePolygonFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…